spiffy.struts1
Class StrutsActionHelper
java.lang.Object
spiffy.struts1.StrutsActionHelper
public class StrutsActionHelper
- extends Object
Helper class for Struts1 actions
- Since:
- 0.03
- Author:
- Kasper B. Graversen, (c) 2007-2008
Method Summary |
org.apache.struts.action.ActionForward |
goForward(org.apache.struts.action.ActionMapping actionMapping,
String forwardName,
String[] urlParams)
Helps you forwarding from one one action to another action and carrying over the parameters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StrutsActionHelper
public StrutsActionHelper()
goForward
public org.apache.struts.action.ActionForward goForward(org.apache.struts.action.ActionMapping actionMapping,
String forwardName,
String[] urlParams)
- Helps you forwarding from one one action to another action and carrying over the parameters. If not carried over,
they disappear from the request scope during forward.
A common use case is to have the SaveAction invoke the DislayListAction. To do this in a
fashion that changes the URL in the users browser, you set the redirect="true" in the action in
struts-config.xml and by uisng this helper method. It will take whatever you info you provide and
encode the url to redict to.
- Parameters:
actionMapping
- Your Struts objectforwardName
- Name of the action in the struts-config.xmlurlParams
- An array of strings where you already have set all the values as strings, e.g. strings such as
"id=1", name="Mr. Anderson"
- Returns:
- A struts forwarderder object
- Throws:
IllegalStateException
- if redirect="true" is not set in the struts config or if forward path is invalid.