dcsimg
Running Servlets in subdirectories
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Miguel_Saenz
Posted On:   Thursday, June 20, 2002 03:40 PM

Hello All,

I can run Servlets from the /WEB-INF/classes subdirectory but if I create a subdirectory and I try to run the servlets from there, it doesn't work.

I have tried compiling the servlets with package but it doesn't work either.

In summary:

Good : /WEB-INF/classes/MyServlet

Bad: /WEB-INF/classes/subdir/MyServlet


Does anybody know why the servlets don't run from subdirectories?

Any help is appreciated

Thank you

Re: Running Servlets in subdirectories

Posted By:   Anonymous  
Posted On:   Thursday, June 20, 2002 11:35 PM

Hello Miguel,

accessing servlet resources can be solved different. One
solution is to reference by package structure. For example
you have a class file named MyServlet in package
com.test.miguel you can access this servlet from another
servlet by dispatching (/servlet/com.test.miguel.MyServlet).
Secondly, towards your actual problem you have to make
an entry in web.xml (alias) to access the subdirectory.
the web.xml-file is to be found in the WEB-INF directory.

for your example:
=================


MyServlet
path.to.servlet.MyServlet


MyServlet
/subdir/MyServlet




hope this will help
About | Sitemap | Contact