How to run your own servlet
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Sunday, November 24, 2002 08:59 AM

Here is my set up compared to the examples folder.. examples/web-inf/classes/HelloWorldExample examples/images examples/jsp examples/servlets <- index.html When the helloworld example runs the url is.. //examples/servlet/helloworldexample This is myprojects.. /myprojects/web-inf/classes/helloworldexample /myprojects/jsp /myprojects/servlets <- index.html When the helloworld myprojects runs the error is " error 404 Location:/myprojects/servlet/HelloWorldExample " How is this possible the dir doesn't exist under the examples version either. The web.xml file under examples doesn't have helloworldexample in it. I am   More>>

Here is my set up compared to the examples folder..

examples/web-inf/classes/HelloWorldExample
examples/images
examples/jsp
examples/servlets <- index.html

When the helloworld example runs the url is..
//examples/servlet/helloworldexample

This is myprojects..
/myprojects/web-inf/classes/helloworldexample
/myprojects/jsp
/myprojects/servlets <- index.html

When the helloworld myprojects runs the error is " error 404 Location:/myprojects/servlet/HelloWorldExample "

How is this possible the dir doesn't exist under the examples version either. The web.xml file under examples doesn't have helloworldexample in it.

I am at a total loss about this and perhaps I need some kind of magic to make it work. Like all things java and linux as well there seems to be need for some luck and magic in all this !

Regards Adrian Mann

   <<Less

Re: How to run your own servlet

Posted By:   Brian_Glodde  
Posted On:   Sunday, November 24, 2002 07:42 PM

Adrian, No luck and magic, only patience while learning the details :)


Your deployment descriptor (web.xml) must contain a servlet mapping for your container (aka server) to know how to locate the resource. The following tags will help:



Servlet Name
Your Servlet Class



Mapping Name
/urlpattern



This link outlines the basic steps for getting a servlet to run.

You should be able to add the proper mappings in web.xml, restart your server and magic should occur! Hope that helps, post again with more details if not.
About | Sitemap | Contact