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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet mapping" Watch "servlet mapping" New topic
Author

servlet mapping

Luk Kopacki
Greenhorn

Joined: Sep 01, 2004
Posts: 1
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?


Luk
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.
 
Don't get me started about those stupid light bulbs.
 
subject: servlet mapping