[
http://www.stripesframework.org/jira/browse/STS-831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12318#comment-12318
]
Timothy Stone commented on STS-831:
-----------------------------------
I've worked this out in a simple Stripes app that addresses the use case
directly. However, some background on Stripes Resolutions.
Stripes has two primary Resolutions, ForwardResolution and RedirectResolution.
A ForwardResolution performs a
ServletContext.getRequestDispatcher(path).forward(req,res) -- or
.include(req,res) as determined by some execution logic, so see source for
details. The RequestDispatcher performs tasks internal to the servlet container
and puts on the response the output of the forwarded or included resource of
the dispatcher. This prevents the path of a ForwardResolution to have a "hash"
or document fragment identifier. The resource cannot be found. Stripes is
correct when a 404 is returned or cannot bind to the URL. Makes sense in
context of what the RequestDispatcher is doing internally.
However, Get-After-Post, or Redirect-After-Side-Effect, can help.
Take the following snippet of an ActionBean:
@DefaultHandler
public Resolution view() {
return new ForwardResolution("/WEB-INF/jsp/home.jsp");
}
@DontValidate
public Resolution foo() {
return new RedirectResolution(getClass(),"view").setAnchor("my");
}
Given a form, <s:form id="my" beanclass="/My.action" ...> and a submit button
of <s:submit name="foo" value="Go"> the event handler of 'foo' is called. A
RedirectResolution is returned with the anchor (a NAMEd anchor element or
IDentified HTML element) is created. Then the view handler is called to present
the view. This is Redirect-After-Side-Effect (probably what you want to do if
you're updating a database and not just GET-ting a resource).
If the code is of interest, I'll post the Maven project for inspection.
> Hash anchors (#) in form action breaks binding to ActionBean
> ------------------------------------------------------------
>
> Key: STS-831
> URL: http://www.stripesframework.org/jira/browse/STS-831
> Project: Stripes
> Issue Type: Bug
> Components: ActionBean Dispatching, Tag Library
> Affects Versions: Release 1.5.6
> Reporter: Carl Krig
> Priority: Minor
> Attachments: STS-831.patch
>
>
> Problem:
> <form action="/My.action#my"> gives an ERROR ... tag.FormTag - Could not
> locate an ActionBean that was bound to the URL [/My.action#my]. Without an
> ActionBean class Stripes cannot determine whether the ActionBean is a wizard
> or not. As a result wizard behaviour will be disabled.
> Expected:
> Properly bind to same as "/My.action" would have. More specifically, drop the
> hash mark and everything that comes after.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development