struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 36037] - Allow query strings and anchors when returning forwards from Action
Date Thu, 01 Dec 2005 17:16:21 GMT
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=36037>.
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=36037





------- Additional Comments From chris@christopherschultz.net  2005-12-01 18:16 -------
I'm glad I searched the enhancement bugs before I added me own! I've written a
class that I use for exactly the same thing, except that it wraps an existing
ActionForward object, and so it's IMO less intrusive than the existing proposal.

I'm going to attach my utility class. Feel free to do whatever you want with
it... I'd really like to see something like this in the org.apache.struts.util
package.

My class extends ActionForward and you can create a new one using a constructor
which takes an existing ActionForward. It adds the methods "addQueryData" and
"setAnchor" (similar to the VelocityTools' LinkTool). Finally, it overrides the
getPath method to return the appropriate String.

A typical usage would be something like this:

return new ForwardBuilder(mapping.findForward("success"))
           .addQueryData("id", myObj.getId())
           .setAnchor("actions")
           ;

It handles mappings that already contain query strings, user-specified encoding,
etc.

Let me know what you guys think.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message