Forums Register Login

servlet mapping

+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
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.
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 985 times.
Similar Threads
why no config in jspInit() method?
invoking servlets differently
Accessing a jpeg or gif in an unpacked war file
related to .do and .faces
welcome-file-list... A BUG?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:06:23.