You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stefan Groschupf <sg...@media-style.com> on 2004/08/24 21:29:22 UTC

forward and set url parameter

Hi,

I wish to forward to a action that require a url parameter.
request.setAttribute does not set a urlParameter in the style 
showBla.do?pk=2323;

How to set such a parameter, since request.getParameterMap().put() has 
no effect?

Thanks for any hints.
Stefan


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


Re: forward and set url parameter

Posted by Stefan Groschupf <sg...@media-style.com>.
Thanks a lot!

Am 25.08.2004 um 00:05 schrieb Guillermo Meyer:

> +1
> Adding a redirect:
>
> public ActionForward executeActionMapping mapping, ActionForm form,
> HttpServletRequest request, HttpServletResponse response) throws
> Exception {
> ActionForward forward = mapping.findForward("success");
> String path = forward.getPath();
> path += "?foo=bar";
> return new ActionForward(path, true);
> }
>
> should work.
>
> If you cant perform a redirect, you could wrap the request in a filter
> and simulate a putParameter by overriding the getParameter... but I
> think that it would be overkilling in your situation, so with the
> redirect stuff you'll be done.
>
>
> Saludos.
> Guillermo.
>
>
> -----Mensaje original-----
> De: Erik Weber [mailto:erikweber@mindspring.com]
> Enviado el: Martes, 24 de Agosto de 2004 05:57 p.m.
> Para: Struts Users Mailing List
> Asunto: Re: forward and set url parameter
>
> public ActionForward executeActionMapping mapping, ActionForm form,
> HttpServletRequest request, HttpServletResponse response) throws
> Exception {
> ActionForward forward = mapping.findForward("success");
> String path = forward.getPath();
> path += "?foo=bar";
> return new ActionForward(path);
> }
>
> But in this case, I'm not sure why you wouldn't just use a request
> attribute instead. By forward, perhaps you mean redirect?
>
> Or, in a JSP link:
>
> <html-el:link 
> page="/actor/usecase?param=${foo.bar}">blah</html-el:link>
>
>
> Erik
>
>
> Stefan Groschupf wrote:
>
>> Hi,
>>
>> I wish to forward to a action that require a url parameter.
>> request.setAttribute does not set a urlParameter in the style
>> showBla.do?pk=2323;
>>
>> How to set such a parameter, since request.getParameterMap().put() has
>
>> no effect?
>>
>> Thanks for any hints.
>> Stefan
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
> ---------------------------------------------------------------------
> 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


RE: forward and set url parameter

Posted by Guillermo Meyer <gm...@fibertel.com.ar>.
+1
Adding a redirect:

public ActionForward executeActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response) throws
Exception {
ActionForward forward = mapping.findForward("success");
String path = forward.getPath();
path += "?foo=bar";
return new ActionForward(path, true);
}

should work.

If you cant perform a redirect, you could wrap the request in a filter
and simulate a putParameter by overriding the getParameter... but I
think that it would be overkilling in your situation, so with the
redirect stuff you'll be done.


Saludos.
Guillermo.


-----Mensaje original-----
De: Erik Weber [mailto:erikweber@mindspring.com] 
Enviado el: Martes, 24 de Agosto de 2004 05:57 p.m.
Para: Struts Users Mailing List
Asunto: Re: forward and set url parameter

public ActionForward executeActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response) throws
Exception {
ActionForward forward = mapping.findForward("success");
String path = forward.getPath();
path += "?foo=bar";
return new ActionForward(path);
}

But in this case, I'm not sure why you wouldn't just use a request 
attribute instead. By forward, perhaps you mean redirect?

Or, in a JSP link:

<html-el:link page="/actor/usecase?param=${foo.bar}">blah</html-el:link>


Erik


Stefan Groschupf wrote:

> Hi,
>
> I wish to forward to a action that require a url parameter.
> request.setAttribute does not set a urlParameter in the style 
> showBla.do?pk=2323;
>
> How to set such a parameter, since request.getParameterMap().put() has

> no effect?
>
> Thanks for any hints.
> Stefan
>
>
> ---------------------------------------------------------------------
> 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



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


Re: forward and set url parameter

Posted by Erik Weber <er...@mindspring.com>.
public ActionForward executeActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionForward forward = mapping.findForward("success");
String path = forward.getPath();
path += "?foo=bar";
return new ActionForward(path);
}

But in this case, I'm not sure why you wouldn't just use a request 
attribute instead. By forward, perhaps you mean redirect?

Or, in a JSP link:

<html-el:link page="/actor/usecase?param=${foo.bar}">blah</html-el:link>


Erik


Stefan Groschupf wrote:

> Hi,
>
> I wish to forward to a action that require a url parameter.
> request.setAttribute does not set a urlParameter in the style 
> showBla.do?pk=2323;
>
> How to set such a parameter, since request.getParameterMap().put() has 
> no effect?
>
> Thanks for any hints.
> Stefan
>
>
> ---------------------------------------------------------------------
> 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