Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

request.getPathInfo()

 
Mike Cronin
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
When attempting a request.getPathInfo() from within a JSP, I encounter an
"Error: 404 File Not Found /CatalogMain.jsp/extra/info"
Here's the sample URL:
http://localhost:8080/CatalogMain.jsp/extra/info?category=0

Here's the Expression:
<p>PathInfo(): <%= request.getPathInfo()%></p>

I expected the previous expression to return "/extra/info"
Any suggestions?
Thanks in advance,
Mike Cronin
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi mike,
i observed the same thing. the reason it doesn't work is i guess as follows,
-the JSP file gets converted into a servlet in the backend when requested for the first time and then that servlet is used to serve future requests
-the servlet name given to the JSP's generated servlet is webserver specific
-the getPathInfo() works ONLY when we access a servlet as we might assume from the following quote from servlet/jsp api,
"Returns any extra path information associated with the URL the client sent when it made this request. The extra path information follows the servlet path but precedes the query string. This method returns null if there was no extra path information. "
-as we DON'T access the servlet generated by the JSP we are not able to use getPathInfo() in JSP the way we do in servlets.
well, this is a limitation but we can always get around it by passing the same information as querystring or something...though that entails changing of the currently working code if we have one...
regards
maulin
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi mike,
actually it works for me on iPlanet4.1 ES and DOESN'T work on Tomcat4.0.5 so i tried to guess the plausible reason but i would say it is a webserver specific thing...
regards
maulin
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!