org.apache.struts2.dojo.components
Class Submit
java.lang.Object
org.apache.struts2.components.Component
org.apache.struts2.components.UIBean
org.apache.struts2.components.ClosingUIBean
org.apache.struts2.components.FormButton
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:
- input: renders as html <input type="submit"...>
- image: renders as html <input type="image"...>
- button: renders as html <button type="submit"...>
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}" />
| 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, standardAttributesMap, tabindex, template, templateDir, templateEngineManager, templateSuffix, theme, title, tooltip, tooltipConfig, tooltipCssClass, tooltipDelay, tooltipIconPath, value |
|
Constructor Summary |
Submit(com.opensymphony.xwork2.util.ValueStack stack,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
| Methods inherited from class org.apache.struts2.components.UIBean |
addFormParameter, buildTemplateName, copyParams, enableAncestorFormCustomOnsubmit, ensureAttributeSafelyNotEscaped, escape, evaluateNameValue, getId, getStandardAttributes, getTemplate, getTemplateDir, getTooltipConfig, getValueClassType, mergeTemplate, setAccesskey, 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, setTabindex, setTemplate, setTemplateDir, setTemplateEngineManager, setTitle, setTooltip, setTooltipConfig, setTooltipCssClass, setTooltipDelay, setTooltipIconPath |
| 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, popComponentStack, setThrowExceptionsOnELFailure, setUrlHelper, stripExpressionIfAltSyntax, toString, usesBody |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
Submit
public Submit(com.opensymphony.xwork2.util.ValueStack stack,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
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-2013 Apache Software Foundation. All Rights Reserved.