Meaningless Drivel is fun!
The moose likes Servlets and the fly likes servlet mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet mapping" Watch "servlet mapping" New topic

servlet mapping

Luk Kopacki

Joined: Sep 01, 2004
Posts: 1

Inside my web.xml:


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?

Gert Cuppens
Ranch Hand

Joined: Jul 13, 2003
Posts: 87
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.
I agree. Here's the link:
subject: servlet mapping
It's not a secret anymore!