Servlets - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

Servlet War File

Servlet War File

shape Description

Servlet War File, WAR file stands for a web Archive file that consists of all the documents of the projects such as web projects. Servlet War File may have any files like Servlets, JSP , HTML , Image. While working on web projects, some time developer may need to import or export other files, then it will be time taking process to work on single files repeatedly so approaching the WAR file is the smart work that consists huge files as a single file. The main advantage of Servlet War File is time consumption why because all files will be merged into a single file then client easily can approach Server to send the data.

Creating WAR File

shape Description

Servlet War File, To create the WAR file user should have JDK tool on the system. Jar tool of JDK is used to create the WAR file , commands are used to create WAR file such as -c switch of  jar and following is the command needs to be inserted at out side the WEB-INF folder. [java]jar -cvf projectname.war *[/java] Verbose output can be utilized to say JVM regarding which type of data to see, here JVM is utilized to do some work where as verbose output is utilized to display the output which has been done by JVM.

Deploying WAR File

shape Description

Developer can deploy WAR file in two ways such as follows While using any IDE such as eclipse, developer will get the WAR file from IDE and paste under WEB-APP folder in Apache tomcat. Then developer can easily access that WAR file. Following is the command to extract the WAR file where -x switch of jar tool will be used. [java]jar -xvf projectname.war[/java]

Difference Between EAR, JAR And WAR Files

JAR File: EJB modules which will have EJB class files and EJB deployment descriptor are packed as JAR files with the extension of .jar. WAR File: Web modules which will have Servlet, JSP,GIF and HTML files are packaged as JAR file with .war( web achive) extension EAR File: Above files are packaged as JAR file with .ear extension and deployed into Application Server.

Summary

shape Key Points

  • The advantage of Servlet War File is the time consumption.
  • Developer can create WAR file from IDE also.
  • verbose output is utilized to display an output which has been done by JVM.