On Thu, 15 Aug 2002, Tony LaPaso wrote:

> Date: Thu, 15 Aug 2002 23:02:57 -0500
> From: Tony LaPaso <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat User <[EMAIL PROTECTED]>,
>      JSP Users <[EMAIL PROTECTED]>
> Subject: ?? JSP and request.getPathInfo() in Tomcat ??
>
> Hi all,
>
> I was hoping someone could explain something. I'm not sure if
> this is a Tomcat issue or a JSP issue.
>
> I'm using Tomcat v4.1.8 on Win 2k.
>

Neither.  It's a servlet specification issue -- particularly how mappings
are applied (see Chapter 11 for more on how extension mapping for patterns
like "*.jsp" works in a servlet world).

> It seems I cannot obtain the "extra path" information at the end
> of a URL from within a JSP. But, if I run the servlet that was
> generated from the JSP, I *can* get the extra path information
> with no problem.
>

You can acquire extra path info in a JSP page if you define an exact
match <servlet-mapping> for your page.

Of course, I think you're nuts to even try ... JSP is for the view layer;
you should be processing transactions through a servlet (which would then
forward to a JSP page for display) with something like the Struts
Framework <http://jakarta.apache.org/struts>.  Then it wouldn't even be an
issue.

Craig McClanahan



> For example, below is a simple JSP (named Test.jsp) which I
> invoke using the URL below. Notice "/extra/path/info" is the
> extra path information at the end of the URL:
>    http://localhost/t/Test.jsp/extra/path/info:
>
>
> <html><head><title>Test</title></head>
> <body>
> <p>
> This is a test...
> <%= "Path Info: " + request.getPathInfo() %>
> </p>
> </body></html>
>
>
> When I run this JSP it produces the output:
>
> "This is a test... Path Info: null"
>
> Notice the request.getPathInfo() is returning null.
>
> Now, if I take the generated servlet class file and place it in
> my WEB-INF/classes directory, and I run the servlet with this
> URL:
>
> http://localhost/t/servlet/org.apache.jsp.Test_jsp/extra/path/inf
> o
>
> I get this output:
>
> "This is a test... Path Info: /extra/path/info"
>
> So, why can a JSP not have access to the extra path information?
> Is this a Tomcat configuration issue or something else?
>
> Thanks...
>
> Tony
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to