tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Keyes" <david.ke...@flashline.com>
Subject RE: jsp:include semantics?
Date Thu, 06 Feb 2003 14:11:23 GMT
OK, oops, the path should have been relative to the webapp.  But now I'm seeing a different
set of problems.  

My original call is to a servlet /myapp/myservlet/param1/param2.  That servlet forwards to
a jsp /myapp/wrapper.jsp.  The jsp then includes the same servlet that called it, but changes
the path, e.g., 

<jsp:include page="/myapp/myservlet/newparam1/newparam2" flush="true"/>

When I set a breakpoint, in the servlet, it seems as if the request object is the same request
object as the one from the original servlet.  Specifically, the URI doesn't reflect the changes
that were made in the jsp.  It's spooky...

Dave

-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org]
Sent: Wednesday, February 05, 2003 3:37 PM
To: Tomcat Users List
Subject: Re: jsp:include semantics?




On Wed, 5 Feb 2003, David Keyes wrote:

> Date: Wed, 5 Feb 2003 12:59:41 -0500
> From: David Keyes <david.keyes@flashline.com>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> Subject: FW: jsp:include semantics?
>
> Hello.
>
> What are the semantics of <jsp:include> in Tomcat 4.0.x?  It seems to me
> that if I jsp:include another jsp, things work fine.  But if I try to
> include a servlet (one that was registered in my web.xml, e.g. url ==
> "/mywebapp/myservlet") the servlet is treated as if it were a
> traditional resource (that is, Tomcat tries to find a file named
> "/mywebapp/myservlet"), which of course can't be found since it doesn't
> exist.
>
> Is this behaviour correct?  Should I be bugging the Jasper people about
> this one?  Are there any non-standards-breaking ways of getting around
> this?
>

The path you specify as an argument to <jsp:include> has to be context
relative.  If "/mywebapp" is the context path of your webapp, then you
should say:

  <jsp:include path="/myservlet" .../>

instead of:

  <jsp:include path="/mywebapp/myservlet" .../>

In addition, if you're using a web connector (instead of Tomcat
standalone), you'll need to tell it to forward "/myservlet" paths to
Tomcat -- this would also affect a direct requests to your servlet from a
browser.

> Thanks...
>
> Dave Keyes
>

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message