• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

WEB-INF mandatory??

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the WEB-INF directory mandatory in a web application?? Will the exam test us on things like this??
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, it is definately mandatory for a j2ee web application.

and exam will contain questions about DD elements.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yea WEB-INF is mandatory....for a web project...

In the exams there may be questions regarding where different types of files(like class files, libs etc.) will be placed inside the web-inf directory.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

I read in one book (David Bridgewater) saying that WEB-INF is not mandatory for a web app to work. Here is what the book has to say about it,


"Having a directory called WEB-INF is a strong recommendation, but not an absolute obligation. Look out for questions that ask you to say whether a web application must have particular directories. The correct answer is �no�! More usually, though, questions will be phrased to allow for this loophole in the specification. So if you see a question along these
lines��Should a servlet class live in the WEB-INF/classes directory?��you are safe to answer �yes.� The expectation is that files normally do live in the recommended file structure."
[ April 30, 2007: Message edited by: Jothi Shankar Kumar Sankararaj ]
 
arch rival
Posts: 2813
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could anyone give an example where a web application loads a servlet that is not in the WEB-INF\classes directory or below?. If anyone can provide this I will try to reproduce it on my own computer.
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jothi Shankar Kumar Sankararaj:
Is the WEB-INF directory mandatory in a web application?? Will the exam test us on things like this??



Most importantly , in a web application where will you put your web.xml.

You have to memorize quite a lot of web.xml tags , you will get questions from web.xml tags.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My argument is that as per what the book says having a WEB-INF is not an obligation?? How can one attest this?? Anyone has tried of a similiar situation??
 
Marcus Green
arch rival
Posts: 2813
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"My argument is that as per what the book says having a WEB-INF is not an obligation??"

If it's not necessary then it should be able to create an web application that acceses servlets without a WEB-INF directory. I have never seen this. If I can see and reproduce such a setup then I'll know that the WEB-INF is not necessary. Unless I see and test such a setup I'll believe that WEB-INF is necessary.
 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course, WEB-INF may be needed to run Servlets. But one can write JSPs with Scriptlets and Declaratives and call them from tomcat/webapps ( to mean that a registerd application can be run ) WITHOUT any WEB-INF directory. Well, JSP is a web component.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sunder Ganapathy:
Of course, WEB-INF may be needed to run Servlets. But one can write JSPs with Scriptlets and Declaratives and call them from tomcat/webapps ( to mean that a registerd application can be run ) WITHOUT any WEB-INF directory. Well, JSP is a web component.



Answer specific to Tomcat.

Check out the web.xml in conf folder of tomcat.That is the web.xml in use and you override the properties by defining another web.xml in WEB-INF folder.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But one can write JSPs with Scriptlets and Declaratives and call them from tomcat/webapps.



My impression was that Tomcat uses the presence of a WEB-INF directory as an indicator that a directory actually is a web app, and will not serve content (including JSPs) from it otherwise.
 
Sunder Ganapathy
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We started the discussion whether WEB-INF directory is needed. Well, it is not needed always. David Bridgewater is right.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sunder,

Can you show us a practical case??
 
Marcus Green
arch rival
Posts: 2813
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I can wind back this discussion a little,
"Is the WEB-INF directory mandatory in a web application??"

I take the expression "web application" to mean the things I expect and are most common to find in a web application (the stuff that the SCWCD exam covers). Thus a meaningful web application might contain JSP, Servlets, Custom Tags, TagFiles and configuration informatin stored in the WEB.XML. If that is what a web application is then you must have a WEB-INF directory.

It is however possible to execute JSP files without a WEB-INF directory, but in my view a meaningful web application is more than JSP files. In short, for the purpose of the exam a web application will need a WEB-INF directory.

I am awaiting anyone giving me an example of executing servlets without the presence of WEB-INF, any takers?
 
Ranch Hand
Posts: 329
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Isn't the DD (web.xml) mandatory?

If the DD is mandatory, then WEB-INF should be mandatory too. How would you put the web.xml file inside the WEB-INF directory (the only place the DD can be) if you haven't that directory inside your web application root path?

And while we are at it. What about META-INF inside a WAR file? Is it mandatory even if we don't need to specify dependencies?

And if META-INF is mandatory, do we need to put a MANIFEST.MF inside META-INF when we don't specify dependencies? Should it be an empty file?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sergio,

Then what would you say for my post??
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic