Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is deployment descriptor is requestion componet to access servlet

 
sun ram
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Do I need to create servlet definition in web.xml file. My understating is optional,
With tomcat 5 I was not able to access the sample servlet.
I have sample servlet in webapps/scwd/WEB-INF/class directory (No package name used)
I am using the following URL, its giving me the error message.
http://localhost:8080/scwd/servlet/TestingServlet

reference URL:
http://www.informit.com/isapi/product_id~%7BEFDC83A5-06F4-4823-9A80-3248B6CF0DDD%7D/element_id~%7BBB84D3D2-26A7-4F94-B468-CCB0F2389A42%7D/st~%7B94C03A97-1188-4875-8A06-17743BA224B7%7D/content/articlex.asp
Is any thing changed in new specification?
SR
 
sun ram
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
some more info:
after adding servlet mapping like this in web.xml file able to access the servlet.
web.xml file:
<servlet>
<servlet-name>TestingServlet</servlet-name>
<servlet-class>TestingServlet</servlet-class>
</servlet>


<servlet-mapping>
<servlet-name>TestingServlet</servlet-name>
<url-pattern>/servlet/TestingServlet</url-pattern>
</servlet-mapping>
URL to access:
http://localhost:8080/scwd/servlet/TestingServlet
SR
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!