and exam will contain questions about DD elements.
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 ]
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.
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.
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.
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.
"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?
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?