• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which path is required to be present in a war file???

 
Biren shah
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i have one doubt regarding one question.

Which path is required to be present in a war file???
A /WEB-INF/web.xml
B /WEB-INF/classes

i think the answer is that web.xml must be present.
it may be possible that my class dont have a single servlet or bean and so no need of classes..

can anybody explain me regarding this.

thanks in advance
biren
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I think none is required, if you are using static html file or JSPs. The web.xml is required if you want to set any configuration in web.xml. The classes directory is required only if you are putting any required class in this directory.

Thanks
 
Biren shah
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks narendra..
i m also of that opinion..but in one mock exam i saw different kind of answer.

can u please tell me some tutorial..document..link..or specificatin where i can confirm with
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

No need of document. Just Try small war file without these components and some static file only. I checked this. It was working fine.

Thanks
 
Biren shah
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi narendra,
i also checked it and found that its working.
what i m concerned is that ..is it a container dependent behaviour..
or is it a spec thing???

anyways thanks
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which path is required to be present in a war file???
A /WEB-INF/web.xml
B /WEB-INF/classes
If you're referring to the J2EE 1.4 specs, technically the web.xml file is mandatory so it should always be present. However, many containers such as Tomcat use a 'default' web.xml if your omit one. However, this is container-dependent behavior.

Java EE 5 clarifies the situation by allowing static applications (i.e. those not containing servlets/JSPs) to legally omit web.xml.

But in my opinion, if you haven't got at least one dynamic component in your Web app., you're wasting the power of the container... you'd be far better off deploying your static app. straight into your standard Web server.
[ July 12, 2006: Message edited by: Charles Lyons ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic