You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Hughes <mh...@feith.com> on 2005/02/15 20:53:40 UTC

Name of JSP in Request

When I am inside a JSP page, is there any way to access the forward path 
in the action mapping:

        <action path="/COLDCache"
                type="com.xyz.actions.admin.COLDCacheAction"
                scope="request">
            <forward name="success"
                     path="/pages/admin/COLDCache.jsp"/>
        </action>

In other words, does Struts, when it forwards control to the JSP page, 
put a variable in the request scope like 
request.setAttribute("path","/pages/admin/COLDCache.jsp");


Re: Name of JSP in Request

Posted by Craig McClanahan <cr...@gmail.com>.
On Tue, 15 Feb 2005 14:53:40 -0500, Matt Hughes <mh...@feith.com> wrote:
> When I am inside a JSP page, is there any way to access the forward path
> in the action mapping:
> 
>         <action path="/COLDCache"
>                 type="com.xyz.actions.admin.COLDCacheAction"
>                 scope="request">
>             <forward name="success"
>                      path="/pages/admin/COLDCache.jsp"/>
>         </action>
> 
> In other words, does Struts, when it forwards control to the JSP page,
> put a variable in the request scope like
> request.setAttribute("path","/pages/admin/COLDCache.jsp");
> 

Struts does not do this for you, but your servlet container will set
the characteristics of the HttpServletRequest object to reflect the
paths of the JSP page.  Thus, in a JSP,

    <%= request.getServletPath() %>

should return you the name of the JSP, not the action to which the
form was submitted.

Craig

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

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