RSS Forums RSS
Please support our JSP advertiser: Lunarpages JSP Web Hosting

running servlets

Join Date: Mar 2007
Posts: 83
Reputation: rgtaylor is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 2
rgtaylor rgtaylor is offline Offline
Junior Poster in Training

Re: running servlets

  #5  
Apr 14th, 2007
First of all, it doesn't matter what you did with the .java file... Tomcat really cares about the servlet .class file

You have to tell Tomcat what you call your servlet within the web.xml file... and what the .class file is... this need to have the package.classname if you used a package... then in the servlet mapping you say which servlet, by name, you mapping to, and you have to give a "pattern" to match.... if you want to use the helloworld name you need to specify the helloworld name in the url pattern...

Or you can make sure the default servlet context is on, if all you want to do is test for learning the sevlets stuff, then you can place your servlet under the proper location and access them via localhost:8080/servlet/helloworld

the default servlet setting is for testing servlets, if you try to use that url "/servlet/helloworld" but you don't have the .class in the default servlet location, it will not run... basically the default servlet look s at the patch after "/servlet/" and tries to find a .class file with that name... if it finds it, it runs it... if not, it shows the error... BUT the default servlet is disabled by default on Tomcat 5.5 I believe, and you would need to enable it.... You can't use that for your application if you have placed it in any other location... this is well commented in the Tomcat config files...

I appologise if my comments are bit off in terminology, I don't have the Tomcat stuff sitting here to check, and I am in Japan so I have to translate much of this stuff roughly from the Japanese terminology we use daily to the English terms... sometimes the translations are not close enough...

Peace,
Post you web.xml and I will take a look at it...
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 5:50 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC