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, id, javascriptTooltip, key, label, labelPosition, labelSeparator, name, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, request, required, requiredposition, response, tabindex, template, templateDir, templateEngineManager, templateSuffix, theme, title, tooltip, tooltipConfig, tooltipCssClass, tooltipDelay, tooltipIconPath, value |
Constructor Summary |
Submit(ValueStack stack,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
Methods inherited from class org.apache.struts2.components.UIBean |
addFormParameter, buildTemplateName, enableAncestorFormCustomOnsubmit, ensureAttributeSafelyNotEscaped, escape, evaluateNameValue, getId, getTemplate, getTemplateDir, getTooltipConfig, getValueClassType, mergeTemplate, setAccesskey, setCssErrorClass, setCssErrorStyle, setDefaultTemplateDir, setDefaultUITheme, setDisabled, setDynamicAttributes, setJavascriptTooltip, setKey, setLabelposition, setLabelSeparator, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setRequired, setRequiredposition, setTabindex, setTemplate, setTemplateDir, setTemplateEngineManager, setTitle, setTooltip, setTooltipConfig, setTooltipCssClass, setTooltipDelay, setTooltipIconPath |
Methods inherited from class org.apache.struts2.components.Component |
addAllParameters, addParameter, altSyntax, altSyntax, completeExpressionIfAltSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findStringIfAltSyntax, findValue, findValue, findValue, getComponentStack, getParameters, getStack, popComponentStack, setThrowExceptionsOnELFailure, stripExpressionIfAltSyntax, 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 java.lang.String OPEN_TEMPLATE
- See Also:
- Constant Field Values
TEMPLATE
public static final java.lang.String TEMPLATE
- See Also:
- Constant Field Values
href
protected java.lang.String href
errorText
protected java.lang.String errorText
executeScripts
protected java.lang.String executeScripts
loadingText
protected java.lang.String loadingText
listenTopics
protected java.lang.String listenTopics
handler
protected java.lang.String handler
formId
protected java.lang.String formId
formFilter
protected java.lang.String formFilter
src
protected java.lang.String src
notifyTopics
protected java.lang.String notifyTopics
showErrorTransportText
protected java.lang.String showErrorTransportText
indicator
protected java.lang.String indicator
showLoadingText
protected java.lang.String showLoadingText
targets
protected java.lang.String targets
beforeNotifyTopics
protected java.lang.String beforeNotifyTopics
afterNotifyTopics
protected java.lang.String afterNotifyTopics
errorNotifyTopics
protected java.lang.String errorNotifyTopics
highlightColor
protected java.lang.String highlightColor
highlightDuration
protected java.lang.String highlightDuration
validate
protected java.lang.String validate
ajaxAfterValidation
protected java.lang.String ajaxAfterValidation
separateScripts
protected java.lang.String separateScripts
transport
protected java.lang.String transport
parseContent
protected java.lang.String parseContent
Submit
public Submit(ValueStack stack,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
getDefaultTemplate
protected java.lang.String getDefaultTemplate()
- Specified by:
getDefaultTemplate
in class UIBean
getDefaultOpenTemplate
public java.lang.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(java.lang.String theme)
- Overrides:
setTheme
in class UIBean
getTheme
public java.lang.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(java.io.Writer writer,
java.lang.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(java.lang.String listenTopics)
- Specified by:
setListenTopics
in interface RemoteBean
setHref
public void setHref(java.lang.String href)
- Specified by:
setHref
in interface RemoteBean
setErrorText
public void setErrorText(java.lang.String errorText)
- Specified by:
setErrorText
in interface RemoteBean
setExecuteScripts
public void setExecuteScripts(java.lang.String executeScripts)
- Specified by:
setExecuteScripts
in interface RemoteBean
setLoadingText
public void setLoadingText(java.lang.String loadingText)
- Specified by:
setLoadingText
in interface RemoteBean
setHandler
public void setHandler(java.lang.String handler)
- Specified by:
setHandler
in interface RemoteBean
setFormFilter
public void setFormFilter(java.lang.String formFilter)
- Specified by:
setFormFilter
in interface RemoteBean
setFormId
public void setFormId(java.lang.String formId)
- Specified by:
setFormId
in interface RemoteBean
setSrc
public void setSrc(java.lang.String src)
setTargets
public void setTargets(java.lang.String targets)
setNotifyTopics
public void setNotifyTopics(java.lang.String notifyTopics)
- Specified by:
setNotifyTopics
in interface RemoteBean
setShowErrorTransportText
public void setShowErrorTransportText(java.lang.String showErrorTransportText)
- Specified by:
setShowErrorTransportText
in interface RemoteBean
setIndicator
public void setIndicator(java.lang.String indicator)
- Specified by:
setIndicator
in interface RemoteBean
setShowLoadingText
public void setShowLoadingText(java.lang.String showLoadingText)
- Specified by:
setShowLoadingText
in interface RemoteBean
setCssClass
public void setCssClass(java.lang.String cssClass)
- Specified by:
setCssClass
in interface RemoteBean
- Overrides:
setCssClass
in class UIBean
setCssStyle
public void setCssStyle(java.lang.String cssStyle)
- Specified by:
setCssStyle
in interface RemoteBean
- Overrides:
setCssStyle
in class UIBean
setId
public void setId(java.lang.String id)
- Overrides:
setId
in class UIBean
setName
public void setName(java.lang.String name)
- Specified by:
setName
in interface RemoteBean
- Overrides:
setName
in class UIBean
setType
public void setType(java.lang.String type)
- Overrides:
setType
in class FormButton
setValue
public void setValue(java.lang.String value)
- Overrides:
setValue
in class UIBean
setLabel
public void setLabel(java.lang.String label)
- Overrides:
setLabel
in class UIBean
setAfterNotifyTopics
public void setAfterNotifyTopics(java.lang.String afterNotifyTopics)
- Specified by:
setAfterNotifyTopics
in interface RemoteBean
setBeforeNotifyTopics
public void setBeforeNotifyTopics(java.lang.String beforeNotifyTopics)
- Specified by:
setBeforeNotifyTopics
in interface RemoteBean
setErrorNotifyTopics
public void setErrorNotifyTopics(java.lang.String errorNotifyTopics)
- Specified by:
setErrorNotifyTopics
in interface RemoteBean
setHighlightColor
public void setHighlightColor(java.lang.String highlightColor)
- Specified by:
setHighlightColor
in interface RemoteBean
setHighlightDuration
public void setHighlightDuration(java.lang.String highlightDuration)
- Specified by:
setHighlightDuration
in interface RemoteBean
setValidate
public void setValidate(java.lang.String validate)
setAjaxAfterValidation
public void setAjaxAfterValidation(java.lang.String ajaxAfterValidation)
setAction
public void setAction(java.lang.String action)
- Overrides:
setAction
in class FormButton
setSeparateScripts
public void setSeparateScripts(java.lang.String separateScripts)
- Specified by:
setSeparateScripts
in interface RemoteBean
setTransport
public void setTransport(java.lang.String transport)
- Specified by:
setTransport
in interface RemoteBean
setParseContent
public void setParseContent(java.lang.String parseContent)
- Specified by:
setParseContent
in interface RemoteBean
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.