"servlet" virtual and "WEB-INF/classes" real directories
1 posts in topic
Flat View  Flat View

Posted By:   Vartan_Nazarian
Posted On:   Saturday, September 28, 2002 10:45 PM

I have a Hello.java servlet which is compiled and placed in the jsp/WEB-INF/classes directory. I then have an html file in jsp/examples directory which sends information to the Hello servlet when you press the submit button in the form tag. The Action attribute is "../servlet/Hello".

My question is that does the "servlet" virtual directory get mapped to "WEB-INF/classes" real directory? Why do we have this mapping in the first place?


Re: "servlet" virtual and "WEB-INF/classes" real directories

Posted By:   AlessandroA_Garbagnati  
Posted On:   Sunday, September 29, 2002 04:54 AM


The "/servlet/" directory is not just a simple mapping. It's more an "invoker". When the Servlet Conatiner receives any request in that directory, it executes a servlet that invokes the requested servlet.

The invoked servet has to be located in tha CLASSPATH. This means that it can be located in the WEB-INF/classes or in any jar located under WEB-INF/lib, plus the CLASSPATH of the Servlet Container that is shared among all the web applications.

That "default" mapping helps has been probably set to create a common and basic mapping that do not require any setting in the web application descriptor.

About | Sitemap | Contact