org.apache.struts2.dojo.components
Class Submit

java.lang.Object
  extended by org.apache.struts2.components.Component
      extended by org.apache.struts2.components.UIBean
          extended by org.apache.struts2.components.ClosingUIBean
              extended by org.apache.struts2.components.FormButton
                  extended by org.apache.struts2.dojo.components.Submit
All Implemented Interfaces:
RemoteBean

public class Submit
extends FormButton
implements RemoteBean

Renders a submit button that can submit a form asynchronously. The submit can have three different types of rendering:

Please note that the button type has advantages by adding the possibility to seperate the submitted value from the text shown on the button face, but has issues with Microsoft Internet Explorer at least up to 6.0

Examples

<sx:submit value="%{'Submit'}" /> <sx:submit type="image" value="%{'Submit'}" label="Submit the form" src="submit.gif"/> <sx:submit type="button" value="%{'Submit'}" label="Submit the form"/> <div id="div1">Div 1</div> <s:url id="ajaxTest" value="/AjaxTest.action"/> <sx:submit id="link1" href="%{ajaxTest}" target="div1" /> <s:form id="form" action="AjaxTest"> <input type="textbox" name="data"> <sx:submit /> </s:form> <s:form id="form" action="AjaxTest"> <input type="textbox" name="data"> </s:form> <sx:submit formId="form" /> <script type="text/javascript"> dojo.event.topic.subscribe("/before", function(event, widget){ alert('inside a topic event. before request'); //event: set event.cancel = true, to cancel request //widget: widget that published the topic }); </script> <sx:submit beforeNotifyTopics="/before" /> <script type="text/javascript"> dojo.event.topic.subscribe("/after", function(data, request, widget){ alert('inside a topic event. after request'); //data : text returned from request(the html) //request: XMLHttpRequest object //widget: widget that published the topic }); </script> <sx:submit afterNotifyTopics="/after" highlightColor="red" href="%{#ajaxTest}" /> <script type="text/javascript"> dojo.event.topic.subscribe("/error", function(error, request, widget){ alert('inside a topic event. on error'); //error : error object (error.message has the error message) //request: XMLHttpRequest object //widget: widget that published the topic }); </script> <img id="ind1" src="${pageContext.request.contextPath}/images/indicator.gif" style="display:none"/> <sx:submit errorNotifyTopics="/error" indicator="ind1" href="%{#ajaxTest}" />


Field Summary
protected  String afterNotifyTopics
           
protected  String ajaxAfterValidation
           
protected  String beforeNotifyTopics
           
protected  String errorNotifyTopics
           
protected  String errorText
           
protected  String executeScripts
           
protected  String formFilter
           
protected  String formId
           
protected  String handler
           
protected  String highlightColor
           
protected  String highlightDuration
           
protected  String href
           
protected  String indicator
           
protected  String listenTopics
           
protected  String loadingText
           
protected  String notifyTopics
           
static String OPEN_TEMPLATE
           
protected  String parseContent
           
protected  String separateScripts
           
protected  String showErrorTransportText
           
protected  String showLoadingText
           
protected  String src
           
protected  String targets
           
static String TEMPLATE
           
protected  String transport
           
protected  String validate
           
 
Fields inherited from class org.apache.struts2.components.FormButton
action, align, method, type
 
Fields inherited from class org.apache.struts2.components.UIBean
accesskey, cssClass, cssErrorClass, cssErrorStyle, cssStyle, defaultTemplateDir, defaultUITheme, disabled, dynamicAttributes, errorPosition, id, javascriptTooltip, key, label, labelPosition, labelSeparator, name, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, request, requiredLabel, requiredPosition, response, tabindex, template, templateDir, templateEngineManager, templateSuffix, theme, title, tooltip, tooltipConfig, tooltipCssClass, tooltipDelay, tooltipIconPath, uiThemeExpansionToken, value
 
Fields inherited from class org.apache.struts2.components.Component
actionMapper, COMPONENT_STACK, devMode, parameters, stack, standardAttributesMap, throwExceptionOnELFailure
 
Constructor Summary
Submit(com.opensymphony.xwork2.util.ValueStack stack, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Method Summary
 boolean end(Writer writer, String body)
          Overrides to be able to render body in a template rather than always before the template
 void evaluateExtraParams()
           
 void evaluateParams()
           
 String getDefaultOpenTemplate()
           
protected  String getDefaultTemplate()
           
 String getTheme()
           
 void setAction(String action)
           
 void setAfterNotifyTopics(String afterNotifyTopics)
           
 void setAjaxAfterValidation(String ajaxAfterValidation)
           
 void setBeforeNotifyTopics(String beforeNotifyTopics)
           
 void setCssClass(String cssClass)
           
 void setCssStyle(String cssStyle)
           
 void setErrorNotifyTopics(String errorNotifyTopics)
           
 void setErrorText(String errorText)
           
 void setExecuteScripts(String executeScripts)
           
 void setFormFilter(String formFilter)
           
 void setFormId(String formId)
           
 void setHandler(String handler)
           
 void setHighlightColor(String highlightColor)
           
 void setHighlightDuration(String highlightDuration)
           
 void setHref(String href)
           
 void setId(String id)
           
 void setIndicator(String indicator)
           
 void setLabel(String label)
           
 void setListenTopics(String listenTopics)
           
 void setLoadingText(String loadingText)
           
 void setName(String name)
           
 void setNotifyTopics(String notifyTopics)
           
 void setParseContent(String parseContent)
           
 void setSeparateScripts(String separateScripts)
           
 void setShowErrorTransportText(String showErrorTransportText)
           
 void setShowLoadingText(String showLoadingText)
           
 void setSrc(String src)
           
 void setTargets(String targets)
           
 void setTheme(String theme)
           
 void setTransport(String transport)
           
 void setType(String type)
           
 void setValidate(String validate)
           
 void setValue(String value)
           
protected  boolean supportsImageType()
          Indicate whether the concrete button supports the type "image".
 
Methods inherited from class org.apache.struts2.components.FormButton
populateComponentHtmlId, setActionMapper, setAlign, setMethod
 
Methods inherited from class org.apache.struts2.components.ClosingUIBean
setOpenTemplate, start
 
Methods inherited from class org.apache.struts2.components.UIBean
addFormParameter, buildTemplateName, copyParams, enableAncestorFormCustomOnsubmit, ensureAttributeSafelyNotEscaped, escape, evaluateNameValue, getId, getTemplate, getTemplateDir, getTooltipConfig, getValueClassType, mergeTemplate, setAccesskey, setClass, setCssErrorClass, setCssErrorStyle, setDefaultTemplateDir, setDefaultUITheme, setDisabled, setDynamicAttributes, setErrorPosition, setJavascriptTooltip, setKey, setLabelposition, setLabelSeparator, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setRequiredLabel, setRequiredPosition, setStyle, setTabindex, setTemplate, setTemplateDir, setTemplateEngineManager, setTitle, setTooltip, setTooltipConfig, setTooltipCssClass, setTooltipDelay, setTooltipIconPath, setUIThemeExpansionToken
 
Methods inherited from class org.apache.struts2.components.Component
addAllParameters, addParameter, altSyntax, completeExpressionIfAltSyntax, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findStringIfAltSyntax, findValue, findValue, findValue, getComponentStack, getParameters, getStack, getStandardAttributes, isValidTagAttribute, popComponentStack, setDevMode, setThrowExceptionsOnELFailure, setUrlHelper, stripExpressionIfAltSyntax, toString, usesBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPEN_TEMPLATE

public static final String OPEN_TEMPLATE
See Also:
Constant Field Values

TEMPLATE

public static final String TEMPLATE
See Also:
Constant Field Values

href

protected String href

errorText

protected String errorText

executeScripts

protected String executeScripts

loadingText

protected String loadingText

listenTopics

protected String listenTopics

handler

protected String handler

formId

protected String formId

formFilter

protected String formFilter

src

protected String src

notifyTopics

protected String notifyTopics

showErrorTransportText

protected String showErrorTransportText

indicator

protected String indicator

showLoadingText

protected String showLoadingText

targets

protected String targets

beforeNotifyTopics

protected String beforeNotifyTopics

afterNotifyTopics

protected String afterNotifyTopics

errorNotifyTopics

protected String errorNotifyTopics

highlightColor

protected String highlightColor

highlightDuration

protected String highlightDuration

validate

protected String validate

ajaxAfterValidation

protected String ajaxAfterValidation

separateScripts

protected String separateScripts

transport

protected String transport

parseContent

protected String parseContent
Constructor Detail

Submit

public Submit(com.opensymphony.xwork2.util.ValueStack stack,
              javax.servlet.http.HttpServletRequest request,
              javax.servlet.http.HttpServletResponse response)
Method Detail

getDefaultTemplate

protected String getDefaultTemplate()
Specified by:
getDefaultTemplate in class UIBean

getDefaultOpenTemplate

public String getDefaultOpenTemplate()
Specified by:
getDefaultOpenTemplate in class ClosingUIBean

evaluateParams

public void evaluateParams()
Overrides:
evaluateParams in class UIBean

evaluateExtraParams

public void evaluateExtraParams()
Overrides:
evaluateExtraParams in class FormButton

setTheme

public void setTheme(String theme)
Overrides:
setTheme in class UIBean

getTheme

public String getTheme()
Overrides:
getTheme in class UIBean

supportsImageType

protected boolean supportsImageType()
Indicate whether the concrete button supports the type "image".

Specified by:
supportsImageType in class FormButton
Returns:
true to indicate type image is supported.

end

public boolean end(Writer writer,
                   String body)
Overrides to be able to render body in a template rather than always before the template

Overrides:
end in class UIBean

setListenTopics

public void setListenTopics(String listenTopics)
Specified by:
setListenTopics in interface RemoteBean

setHref

public void setHref(String href)
Specified by:
setHref in interface RemoteBean

setErrorText

public void setErrorText(String errorText)
Specified by:
setErrorText in interface RemoteBean

setExecuteScripts

public void setExecuteScripts(String executeScripts)
Specified by:
setExecuteScripts in interface RemoteBean

setLoadingText

public void setLoadingText(String loadingText)
Specified by:
setLoadingText in interface RemoteBean

setHandler

public void setHandler(String handler)
Specified by:
setHandler in interface RemoteBean

setFormFilter

public void setFormFilter(String formFilter)
Specified by:
setFormFilter in interface RemoteBean

setFormId

public void setFormId(String formId)
Specified by:
setFormId in interface RemoteBean

setSrc

public void setSrc(String src)

setTargets

public void setTargets(String targets)

setNotifyTopics

public void setNotifyTopics(String notifyTopics)
Specified by:
setNotifyTopics in interface RemoteBean

setShowErrorTransportText

public void setShowErrorTransportText(String showErrorTransportText)
Specified by:
setShowErrorTransportText in interface RemoteBean

setIndicator

public void setIndicator(String indicator)
Specified by:
setIndicator in interface RemoteBean

setShowLoadingText

public void setShowLoadingText(String showLoadingText)
Specified by:
setShowLoadingText in interface RemoteBean

setCssClass

public void setCssClass(String cssClass)
Specified by:
setCssClass in interface RemoteBean
Overrides:
setCssClass in class UIBean

setCssStyle

public void setCssStyle(String cssStyle)
Specified by:
setCssStyle in interface RemoteBean
Overrides:
setCssStyle in class UIBean

setId

public void setId(String id)
Overrides:
setId in class UIBean

setName

public void setName(String name)
Specified by:
setName in interface RemoteBean
Overrides:
setName in class UIBean

setType

public void setType(String type)
Overrides:
setType in class FormButton

setValue

public void setValue(String value)
Overrides:
setValue in class UIBean

setLabel

public void setLabel(String label)
Overrides:
setLabel in class UIBean

setAfterNotifyTopics

public void setAfterNotifyTopics(String afterNotifyTopics)
Specified by:
setAfterNotifyTopics in interface RemoteBean

setBeforeNotifyTopics

public void setBeforeNotifyTopics(String beforeNotifyTopics)
Specified by:
setBeforeNotifyTopics in interface RemoteBean

setErrorNotifyTopics

public void setErrorNotifyTopics(String errorNotifyTopics)
Specified by:
setErrorNotifyTopics in interface RemoteBean

setHighlightColor

public void setHighlightColor(String highlightColor)
Specified by:
setHighlightColor in interface RemoteBean

setHighlightDuration

public void setHighlightDuration(String highlightDuration)
Specified by:
setHighlightDuration in interface RemoteBean

setValidate

public void setValidate(String validate)

setAjaxAfterValidation

public void setAjaxAfterValidation(String ajaxAfterValidation)

setAction

public void setAction(String action)
Overrides:
setAction in class FormButton

setSeparateScripts

public void setSeparateScripts(String separateScripts)
Specified by:
setSeparateScripts in interface RemoteBean

setTransport

public void setTransport(String transport)
Specified by:
setTransport in interface RemoteBean

setParseContent

public void setParseContent(String parseContent)
Specified by:
setParseContent in interface RemoteBean


Copyright © 2000–2018 Apache Software Foundation. All rights reserved.