DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=866>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=866

Clean Way to Add Parameters to Redirecting Forward





------- Additional Comments From [EMAIL PROTECTED]  2004-10-12 01:23 -------
I just posted a utility earlier in the day after reading the initial issue.  I
should explain the patch I added is a very basic utility method for adding query
parameters to a request:

public static ActionForward addQueryParamsToForward(Map parameterMap,
ActionForward forward)

The method will basically create a new ActionForward from the forward given
appending the parameter map.  This is an easy solution to the initial request. 
I just had an opportunity to look through the attached ActionRedirect wrapper. 
I think this a very interesting approach.  The class I added is much simpler
(and does not require any config changes, special request processing etc). 
Those changes are required in the ActionRedirect class to support "carrying
over" action messages / error messages.

Both may be of use to Struts developers.  

Simple use case.

ActionForward forward = mapping.findForward("success");
Map params = request.getParameterMap();
params.put("newID", "101");
return StrutsUtil.addQueryParamsToForward(params, forward);

I do also like the wrapper approach used by the ActionRedirect patch.  I don't
know how I feel about all the other config overhead with propagating the action
messages.

- Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to