You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jim Kennedy <ji...@gigaheads.com> on 2003/07/23 21:03:20 UTC

Dynamic ActionMapping params

I have created several sites that use the "mapping.findForward("BLA") method to forward (or redirect) to a relative URL.  This has always been statically specified in my struts-config.xml like this:

<forward name="success" path="/main_layout.jsp" redirect="true"/>

then in code I do:

mapping.findForward("BLA");   //(simple stuff)



Now I have a need to forward to a URL that will have dynamic parameters like this:

/main_layout.jsp?param1=value&param2=value$param3=value

Not sure how to pull this off.  Obviously I can't use a statically defined forward definition.  I guess I could put the params in the request, which works fine if I forward, but what if I redirect.  I would have to put them in the session.  Not clean coding in my opinion.  I would rather specify as querystring params.

Anyone done this?

I am using Struts v1.02



Jim Kennedy
IT Consultant
-----------------------------------------------------



Re: Dynamic ActionMapping params

Posted by Michael Ruppin <mr...@yahoo.com>.
--- Jim Kennedy <ji...@gigaheads.com> wrote:
> I have created several sites that use the
> "mapping.findForward("BLA") method to forward (or
> redirect) to a relative URL.  This has always been
> statically specified in my struts-config.xml like
> this:
> 
> <forward name="success" path="/main_layout.jsp"
> redirect="true"/>
> 
> then in code I do:
> 
> mapping.findForward("BLA");   //(simple stuff)
> 
> 
> 
> Now I have a need to forward to a URL that will have
> dynamic parameters like this:
> 
>
/main_layout.jsp?param1=value&param2=value$param3=value
> 
> Not sure how to pull this off.  Obviously I can't
> use a statically defined forward definition.  I
> guess I could put the params in the request, which
> works fine if I forward, but what if I redirect.  I
> would have to put them in the session.  Not clean
> coding in my opinion.  I would rather specify as
> querystring params.

I'm doing that, with 1.1-rc1:

  ActionForward forwardfrommapping =
mapping.findForward("BLA");
  if (forwardfrommapping != null)
  {
      forward = new
ActionForward(forwardfrommapping.getPath() +
"?param1=" + param1.value(), true);
  }

Of course, beware that getPath() may give you more
than "/main_layout.jsp" when the struts-config changes
;)

m

> Anyone done this?
> 
> I am using Struts v1.02
> 
> 
> 
> Jim Kennedy
> IT Consultant
>
-----------------------------------------------------
> 
> 
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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