Creating WAR file for a web application

Hi ,

I am trying to create a web application with J2EE 5. The book I am reffering is "Java Server Programming J2EE 1.3 by Allamaraju and Buest".

In this book, it is given that while creating an application, a new web component wizard for creating a WAR file will appear. But, I can't see any such wizard using console manager of J2EE 5. I do not know how to create WAR files.

Please anybody help me. Thanks in advance.

[444 byte] By [baggaa] at [2007-10-3 4:09:49]
# 1

Hi bagga,

A WAR file is simply a JAR file with a special directory format. You should put all of your public/normal web files (e.g. HTML pages, images) in the root directory (or sub-directories - e.g. /img/). If you need to write a web.xml file to describe servlets, etc. then this should be put in /WEB-INF. Any classes that exist in your web archive - such as servlets - should be put in /WEB-INF/classes. Finally, any libraries that your servlets depend on (apart from EJBs) should be put into WEB-INF/lib.

So an example JAR-tree for 'myapp.war' might look like:

/index.html

/img/mylogo.png

/WEB-INF/web.xml

/WEB-INF/classes/uk/org/fuzelogik/example/MyServlet.class

/WEB-INF/lib/some-lib.jar

Hope this helps.

-Chris

fuzelogika at 2007-7-14 22:09:56 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...