Package org.apache.struts2.result
Class PostbackResult
java.lang.Object
org.apache.struts2.result.StrutsResultSupport
org.apache.struts2.result.PostbackResult
- All Implemented Interfaces:
- Serializable,- Result,- StrutsStatics
A result that renders the current request parameters as a form which immediately submits a postback to the specified destination.
Parameters:
- location - http location to post the form
- prependServletContext (true|false) - when location is relative, controls if to add Servlet Context, default "true"
- actionName - action name to post the form (resolved as an expression)
- namespace - action's namespace to use (resolved as an expression)
- method - actions' method to use (resolved as an expression)
- cache (true|false) - when set to true adds cache control headers, default "true"
- parse (true|false) - when set to true actionName, namespace and method are parsed, default "true"
Examples:
 
 <action name="registerThirdParty" >
   <result type="postback">https://www.example.com/register</result>
 </action>
 <action name="registerThirdParty" >
   <result type="postback">
     <param name="namespace">/secure</param>
     <param name="actionName">register2</param>
   </result>
 </action>
 
 - See Also:
- 
Field SummaryFieldsFields inherited from class org.apache.struts2.result.StrutsResultSupportDEFAULT_PARAM, DEFAULT_URL_ENCODING, parseLocationFields inherited from interface org.apache.struts2.StrutsStaticsACTION_MAPPING, HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voiddoExecute(String finalLocation, ActionInvocation invocation) Executes the result given a final location (jsp page, action, etc) and the action invocation (the state in which the action was executed).voidexecute(ActionInvocation invocation) Implementation of the execute method from the Result interface.protected booleanisElementIncluded(String name, String[] values) Determines if the specified form input element should be included.protected StringmakePostbackUri(ActionInvocation invocation) final voidsetActionMapper(ActionMapper mapper) final voidsetActionName(String actionName) Sets the name of the destination action.final voidsetCache(boolean cache) Stores the option to cache the rendered intermediate page.final voidSets the method of the destination action.final voidsetNamespace(String namespace) Sets the namespace of the destination action.final voidsetPrependServletContext(boolean prependServletContext) protected voidwriteFormElement(PrintWriter pw, String name, String[] values) protected voidOutputs the script after the form has been emitted.Methods inherited from class org.apache.struts2.result.StrutsResultSupportconditionalParse, conditionalParseCollection, getLastFinalLocation, getLocation, setEncode, setLocation, setParse
- 
Field Details- 
actionMapper
 
- 
- 
Constructor Details- 
PostbackResultpublic PostbackResult()
 
- 
- 
Method Details- 
doExecuteDescription copied from class:StrutsResultSupportExecutes the result given a final location (jsp page, action, etc) and the action invocation (the state in which the action was executed). Subclasses must implement this class to handle custom logic for result handling.- Specified by:
- doExecutein class- StrutsResultSupport
- Parameters:
- finalLocation- the location (jsp page, action, etc) to go to.
- invocation- the execution state of the action.
- Throws:
- Exception- if an error occurs while executing the result.
 
- 
executeDescription copied from class:StrutsResultSupportImplementation of the execute method from the Result interface. This will call the abstract methodStrutsResultSupport.doExecute(String, ActionInvocation)after optionally evaluating the location as an OGNL evaluation.- Specified by:
- executein interface- Result
- Overrides:
- executein class- StrutsResultSupport
- Parameters:
- invocation- the execution state of the action.
- Throws:
- Exception- if an error occurs while executing the result.
 
- 
isElementIncludedDetermines if the specified form input element should be included.- Parameters:
- name- the input element name
- values- the input element values
- Returns:
- trueif included; otherwise- false
 
- 
makePostbackUri
- 
setActionMapper
- 
setActionNameSets the name of the destination action.- Parameters:
- actionName- the action name
 
- 
setCachepublic final void setCache(boolean cache) Stores the option to cache the rendered intermediate page. The default istrue.- Parameters:
- cache- enable/disable cache
 
- 
setMethodSets the method of the destination action.- Parameters:
- method- the method
 
- 
setNamespaceSets the namespace of the destination action.- Parameters:
- namespace- the namespace
 
- 
setPrependServletContextpublic final void setPrependServletContext(boolean prependServletContext) 
- 
writeFormElementprotected void writeFormElement(PrintWriter pw, String name, String[] values) throws UnsupportedEncodingException - Throws:
- UnsupportedEncodingException
 
- 
writePrologueScriptOutputs the script after the form has been emitted. The default script is to submit the form using a JavaScript time out that immediately expires.- Parameters:
- pw- the print writer
 
 
-