File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Is it useful to deploy by a .war file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Is it useful to deploy by a .war file?" Watch "Is it useful to deploy by a .war file?" New topic

Is it useful to deploy by a .war file?

Karim Kiswarday
Ranch Hand

Joined: Oct 01, 2010
Posts: 50

Hello guys,
I'm a novice and I don't have big experience about the .war deploy, and I would like to know whether to deploy a web project by .war file is the better solution or no.

If my project is small, I'll not have problems to deploy everything again, but if my project has a medium size, I'll need to re-deploy everything (e.g. a lot of pictures) only why I need to fix a line of code.
Maybe I can re-deploy only the single file, but in this case the .war is useful only the first time I deploy my web application.

And if I have some text files created from my application, when I deploy the .war file are they deleted?

Where do I wrong in my reasoning?


No fun at the table, no fun in the sack.
Ganesan Ponnusamy
MyExamCloud Support
Ranch Hand

Joined: Nov 07, 2005
Posts: 264
Karim Kiswarday,

Since JSP, Servlet and JSF components are used to concentrate solely on presentation logic, it makes sense to put them into a separate module (as WAR file). The web related artifacts (Facelets, backing beans, servlet class files, JSP files, supporting class files, GIF and HTML files, and a web application deployment descriptor) go into a Web Archive (WAR) file which represents the Web module.

By automated build task like ANT, we can easily deploy the application by single command. Java EE 6 improved lot to simplify EJB deployment as well. You no need to create seperate JAR file for EJBs, just copy .class into WAR file.

[WAR] The deployment process expands the EAR/WAR file into a temporary directory and (conceptually), the compressed EAR/WAR file is considered to be the application.
[Expanded directory] You can expand the EAR/WAR file manually, and then deploy the expanded directory structure, which becomes your working directory.

Why WAR/EAR deployment?

Application isolation
Separate class loaders
Problems encountered by one application have no effect on other applications

Choosing the option (WAR or Expanded directory) is depends on your project complexity. But it is always better to use WAR deployment to to test your production issues.


Ganesan P
MyExamCloud for Java SE Certifications, Java EE Certifications and Java ME Certification Preparation.
I agree. Here's the link:
subject: Is it useful to deploy by a .war file?
It's not a secret anymore!