| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.struts2.dispatcher.StrutsResultSupport
org.apache.struts2.dispatcher.ServletRedirectResult
org.apache.struts2.dispatcher.ServletActionRedirectResult
public class ServletActionRedirectResult
 This result uses the ActionMapper provided by the ActionMapperFactory to redirect the browser to a
 URL that invokes the specified action and (optional) namespace. This is better than the ServletRedirectResult
 because it does not require you to encode the URL patterns processed by the ActionMapper in to your struts.xml
 configuration files. This means you can change your URL patterns at any point and your application will still work.
 It is strongly recommended that if you are redirecting to another action, you use this result rather than the
 standard redirect result.
 See examples below for an example of how request parameters could be passed in.
 
 This result type takes the following parameters:
 
 
 <package name="public" extends="struts-default">
     <action name="login" class="...">
         <!-- Redirect to another namespace -->
         <result type="redirectAction">
             <param name="actionName">dashboard</param>
             <param name="namespace">/secure</param>
         </result>
     </action>
 </package>
 <package name="secure" extends="struts-default" namespace="/secure">
     <-- Redirect to an action in the same namespace -->
     <action name="dashboard" class="...">
         <result>dashboard.jsp</result>
         <result name="error" type="redirectAction">error</result>
     </action>
     <action name="error" class="...">
         <result>error.jsp</result>
     </action>
 </package>
 <package name="passingRequestParameters" extends="struts-default" namespace="/passingRequestParameters">
    <-- Pass parameters (reportType, width and height) -->
    <!--
    The redirectAction url generated will be :
    /genReport/generateReport.action?reportType=pie&width=100&height=100
    -->
    <action name="gatherReportInfo" class="...">
       <result name="showReportResult" type="redirectAction">
          <param name="actionName">generateReport</param>
          <param name="namespace">/genReport</param>
          <param name="reportType">pie</param>
          <param name="width">100</param>
          <param name="height">100</param>
          <param name="empty"></param>
          <param name="supressEmptyParameters">true</param>
       </result>
    </action>
 </package>
 
ActionMapper, 
Serialized Form| Field Summary | |
|---|---|
protected  String | 
actionName
 | 
static String | 
DEFAULT_PARAM
The default parameter  | 
private static Logger | 
LOG
 | 
protected  String | 
method
 | 
protected  String | 
namespace
 | 
protected  List<String> | 
prohibitedResultParam
 | 
private  Map<String,String> | 
requestParameters
 | 
private static long | 
serialVersionUID
 | 
protected  boolean | 
supressEmptyParameters
 | 
| Fields inherited from class org.apache.struts2.dispatcher.ServletRedirectResult | 
|---|
actionMapper, prependServletContext, statusCode | 
| Fields inherited from interface org.apache.struts2.StrutsStatics | 
|---|
HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_PORTLET_CONTEXT | 
| Constructor Summary | |
|---|---|
ServletActionRedirectResult()
 | 
|
ServletActionRedirectResult(String actionName)
 | 
|
ServletActionRedirectResult(String actionName,
                            String method)
 | 
|
ServletActionRedirectResult(String namespace,
                            String actionName,
                            String method)
 | 
|
| Method Summary | |
|---|---|
 ServletActionRedirectResult | 
addParameter(String key,
             Object value)
Adds a request parameter to be added to the redirect url  | 
 void | 
execute(ActionInvocation invocation)
Implementation of the execute method from the Result interface.  | 
 void | 
handle(ReflectionException ex)
 | 
 void | 
setActionName(String actionName)
Sets the action name  | 
 void | 
setMethod(String method)
Sets the method  | 
 void | 
setNamespace(String namespace)
Sets the namespace  | 
 void | 
setSupressEmptyParameters(boolean supressEmptyParameters)
Sets the supressEmptyParameters option  | 
| Methods inherited from class org.apache.struts2.dispatcher.ServletRedirectResult | 
|---|
doExecute, sendRedirect, setActionMapper, setPrependServletContext, setStatusCode | 
| Methods inherited from class org.apache.struts2.dispatcher.StrutsResultSupport | 
|---|
conditionalParse, getLastFinalLocation, getLocation, setEncode, setLocation, setParse | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
private static final long serialVersionUID
public static final String DEFAULT_PARAM
private static final Logger LOG
protected String actionName
protected String namespace
protected String method
protected boolean supressEmptyParameters
private Map<String,String> requestParameters
protected List<String> prohibitedResultParam
| Constructor Detail | 
|---|
public ServletActionRedirectResult()
public ServletActionRedirectResult(String actionName)
public ServletActionRedirectResult(String actionName,
                                   String method)
public ServletActionRedirectResult(String namespace,
                                   String actionName,
                                   String method)
| Method Detail | 
|---|
public void execute(ActionInvocation invocation)
             throws Exception
StrutsResultSupportStrutsResultSupport.doExecute(String, ActionInvocation) after optionally evaluating the
 location as an OGNL evaluation.
execute in interface Resultexecute in class StrutsResultSupportinvocation - the execution state of the action.
Exception - if an error occurs while executing the result.Result.execute(com.opensymphony.xwork2.ActionInvocation)public void setActionName(String actionName)
actionName - The namepublic void setNamespace(String namespace)
namespace - The namespacepublic void setMethod(String method)
method - The methodpublic void setSupressEmptyParameters(boolean supressEmptyParameters)
suppress - The new value for this option
public ServletActionRedirectResult addParameter(String key,
                                                Object value)
key - The parameter namevalue - The parameter valuepublic void handle(ReflectionException ex)
handle in interface ReflectionExceptionHandler
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||