Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

servlet mapping

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

Inside my web.xml:

<servlet>
<servlet-name>bigServlet</servlet-name>
<jsp-file>big_common/_getdata.jsp</jsp-file>
</servlet>

<servlet-mapping>
<servlet-name>bigServlet</servlet-name>
<url-pattern>big/servlet/*</url-pattern>
</servlet-mapping>
The problem is when I'm trying to invoke request.getServletPath() inside _getdata.jsp, because it returns path:"/big_common/_getdata.jsp". But when I use <servlet-class>BigServlet</servlet-class> instead of <jsp-file> then the
result of request.getServletPath(), invoked inside BigServlet, is "big/servlet/".Why I can't get path from <servlet-mapping> inside jsp file?
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The impression I get from reading your text, is that you're complicating your life. I never mention my JSP's inside the web.xml. In my last web application, I only mentioned one servlet in the web.xml. This servlet decides which JSP it should call, depending on the different parameters which are in the request. So I wonder why you should be able to read the servletpath in your JSP.
Try to let the servlet do all the work and let the JSP do the layout work.
 
Space seems cool in the movies, but once you get out there, it is super boring. Now for a fascinating tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic