You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Ted Husted (JIRA)" <ji...@apache.org> on 2006/07/12 21:52:16 UTC
[jira] Updated: (STR-2538) Allow query strings and anchors when
returning forwards from Action
[ http://issues.apache.org/struts/browse/STR-2538?page=all ]
Ted Husted updated STR-2538:
----------------------------
Bugzilla Id: (was: 36037)
Version: 1.3.4
(was: 1.3.0)
Assign To: (was: Struts Developers)
> Allow query strings and anchors when returning forwards from Action
> -------------------------------------------------------------------
>
> Key: STR-2538
> URL: http://issues.apache.org/struts/browse/STR-2538
> Project: Struts 1
> Type: Improvement
> Components: Core
> Versions: 1.3.4
> Environment: Operating System: other
> Platform: Other
> Reporter: Frank W. Zammetti
> Priority: Minor
> Fix For: Future
> Attachments: ActionRedirect.java, ForwardBuilder.java, ForwardBuilderTests.java, NameValuePair.java, queryStringAnchors.patch, test.zip
>
> This was prompted by a recent question on the User's list, although I have
> seen similar questions come up many times...
> At the end of a typical Action, a developer does:
> return mapping.findForward("someForward");
> This will, typically, forward to some JSP. It is sometimes desireable to pass
> parameters to that JSP, or to the next Action if the developer chooses to
> forward to a mapping. It is also sometimes desireable to be able to send an
> anchor along so that the browser will jump to the named anchor on the returned
> page.
> Both of these can be accomplished by "cloning" the returned forward and
> manually setting the path appropriately. However, I believe this is more work
> than it really needs to be. Even though it's not a big deal to do, we've
> probably all done it at some point, it does require a developer to know the
> internals of Struts a little more than they maybe should (i.e., they have to
> understand that a ForwardConfig is frozen and has to be cloned to alter its
> fields), and I believe this modification removes that neccessity.
> The attached patch enables this capability in a more developer-friendly way,
> namely that they can simply append the query string and/or anchor to the
> forward name requested, like so:
> return mapping.findForward("someMapping?myParam=myVal#myAnchor");
> In most cases this will probably be constructed dynamically in the Action, but
> the result is the same.
> The patch affects four classes: RequestProcessor, PerformForward,
> ActionMapping and ActionForward. ActionForward simply has two new fields and
> associated bean methods, "queryString" and "anchor". RequestProcessor and
> PerformForward have identical new code, namely two lines that simply append
> the query string and anchor to the URI forwarded or redirected to.
> ActionMapping is where the more involved (relatively-speaking) changes are,
> but then only in the findForward() method (as well as one new import).
> Attached is also a dirt-simple sample app to demonstrate this working. Should
> just be able to drop it in any container and give it a wirl.
> It is my hope that enough people find this useful (and find no problems with
> it of course!) to warrant being committed for the 1.3 release. I think more
> than a few people will thank us for it :)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira