Hello Rickard,

If I understand what you're trying to do correctly, this is the answer (from the
servlet 2.2 spec, 8.3.1):

When a servlet is being used from within an include, it is sometimes necessary for
that servlet to know the path by which it was invoked and not the original request
paths. The following request attributes are set:

javax.servlet.include.request_uri
javax.servlet.include.context_path
javax.servlet.include.servlet_path
javax.servlet.include.path_info
javax.servlet.include.query_string

These attributes are accessible from the included servlet via the getAttribute
method on the request object.
If the included servlet was obtained by using a NamedDispatcher, these attributes
are not set.

Regards,
Karl Avedal

Rickard Oberg wrote:

> Hi!
>
> I am fiddling with a Model-2 framework (yeah, yet another one). It is going
> well except for one thing. I have decided to give the action name as extra
> path info to the servlet, like this (where "action" has been mapped to my
> dispatcher servlet):
> /servlet/action/DoStuff?foo=bar
> i.e. invoke DoStuff action with foo parameter set to bar. So far so good.
>
> However, in the JSP that is delegated to after DoStuff execution I have a
> jsp:include that can either point to another action or to another plain jsp,
> like this:
> <jsp:include page="/servlet/action/OtherStuff" flush="true"/>
> or simply:
> <jsp:include page="somepage.jsp" flush="true"/>
>
> However, it seems like this is invoked with the servlet set to
> "/servlet/action" and the path info to "DoStuff", i.e. the original info.
>
> So, is it possible to call subpages like this? How do I do to get the right
> path info propagated?
>
> Or, do I have to change to a parameter based scheme:
> /servlet/action?action=DoStuff
>
> This works, but is uglier...
>
> Any ideas?
>
> regards,
>   Rickard
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to