• 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

Running Servlet

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have started reading the Hanumant's guide from last 3 days. When we run servlet , say http://localhost:8080/chapter01/servlet/HelloWorldServlet , why we give the servlet as a directory under chapter01. There is no direcory called servlet in web-inf direcory. Can somebody help me to understand this?
Thanks
Salima
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
"chapter01" here is the define by servlet/jsp container, it is not define in *.war file.
for example, in tomcat, "chapter01" is the parent directory of your web application.
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear salima,
Actually yr web-inf directory and its all folders r Private where as rest of all folders r for public use.
The mean to say as private to container b'coz an application can not link to directly these resources (within Web-inf).
Moreover, web-inf/classes directory is mapped(or refered - alias) as servlet directory in a container.
So when ever link has like "http://localhost:8080/chapter01/servlet/HelloWorldServlet, container will search in a web-inf directory of chapter01 docbase.
With best regards, Dharmin
 
Salima Lalani
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot!!
Salima
 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Tomcat, the /servlet/ mapping is done by the "invoker" servlet in the global web.xml file present in install_dir/conf directory. However, this mapping can be overridden in our local web.xml file's servlet-mapping section.
Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic