• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

accessing servlets

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi!
i just passed prog. cert. and i am a beginner in servlets.
my servlets are in
C:\WINDOWS\Desktop\jsdk2.1\webpages\WEB-INF\servlets
and i use
http:/localhost:8080/servlet/MYServletName
in the browser to access the servlets
but if i want to place my servlets in another dir. say dir1 in servlets directory ie in
C:\WINDOWS\Desktop\jsdk2.1\webpages\WEB-INF\servlets\dir1

the on accessing the servlet by
http:/localhost:8080/servlet/dir1/MYServletName
gives error

can someone help what should i do.
madhur
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you need to define a servlet-mapping for your servlet in the web.xml file.
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Servlet classes should all be in the following directory (as per spec.)
webContainer/webapps/myWebApp/WEB-INF/classes
If they are in a package they should be be in the appropriate directory, i.e.
webContainer/webapps/myWebApp/WEB-INF/classes/gov.fbi.SecretFileServlet
You then can map a name to the servlet like:
http://www.fbi.gov/myWebApp/SecretFileServlet
in the web.xml file (which is located in the WEB-INF directory).
Hope this helps,
Thomas
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic