You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jun-hee Yoo <ih...@myscan.org> on 2001/04/26 09:39:26 UTC

getPathInfo() recieved by jsp:include?

i'm not sure if it is a bug, or if it is already corrected, but I find
that when a jsp page uses the jsp:include tag and includes the output of
a servlet, the servlet can't get the PATH_INFO.

i mean that, if a jsp page has some sort of code like this, 

<jsp:include page="/some/servlet/TheServlet/with/extra/path/info" />

(calls the servlet with extra path info)

in the servlet, request.getPathInfo() is null. (i didn't figure out if it
was null, but at least it was some value that i didn't thought of.)

is this a bug? or is this supposed to be like this?
(used tomcat 3.2.1)


Re: getPathInfo() recieved by jsp:include?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 26 Apr 2001, Jun-hee Yoo wrote:

> 
> i'm not sure if it is a bug,

Nope ... it is a misunderstanding on your part.

> or if it is already corrected, but I find
> that when a jsp page uses the jsp:include tag and includes the output of
> a servlet, the servlet can't get the PATH_INFO.
> 
> i mean that, if a jsp page has some sort of code like this, 
> 
> <jsp:include page="/some/servlet/TheServlet/with/extra/path/info" />
> 
> (calls the servlet with extra path info)
> 
> in the servlet, request.getPathInfo() is null. (i didn't figure out if it
> was null, but at least it was some value that i didn't thought of.)
> 
> is this a bug? or is this supposed to be like this?
> (used tomcat 3.2.1)
> 
> 

When you use <jsp:include> (or, more generally,
RequestDispatcher.include()), the request parameters seen by the included
page or servlet are those for the *original* request.  If you want to see
the parameters related to the include request, this information is
provided in a series of request attributes, as defined by the servlet spec
(see <http://java.sun.com/products/servlet/download.html>).

For example, to grab the "/with/extra/path/info" string above, you would
say:

	String pathInfo = (String)
	  request.getAttribute("javax.servlet.include.path_info");

in the included servlet.

Craig McClanahan