org.apache.struts2.dojo.components
Class Bind
java.lang.Object
org.apache.struts2.components.Component
org.apache.struts2.components.UIBean
org.apache.struts2.components.ClosingUIBean
org.apache.struts2.dojo.components.AbstractRemoteBean
org.apache.struts2.dojo.components.AbstractValidateBean
org.apache.struts2.dojo.components.Bind
- All Implemented Interfaces:
- RemoteBean
public class Bind
- extends AbstractValidateBean
This tag will generate event listeners for multiple events on multiple sources,
making an asynchronous request to the specified href, and updating multiple targets.
Examples
<sx:bind href="%{#ajaxTest}" listenTopics="/makecall"/>
<s:submit onclick="dojo.event.topic.publish('/makecall')"/>
<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
<sx:bind id="ex1" href="%{#ajaxTest}" sources="button" targets="div1" events="onclick" indicator="indicator" />
<s:submit theme="simple" type="submit" value="submit" id="button"/>
<sx:bind id="ex3" href="%{#ajaxTest}" sources="chk1" targets="div1" events="onchange" formId="form1" />
<form id="form1">
<s:checkbox name="data" label="Hit me" id="chk1"/>
</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>
<input type="button" id="button">
<sx:bind id="ex1" href="%{#ajaxTest}" beforeNotifyTopics="/before" sources="button" events="onclick"/>
<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>
<input type="button" id="button">
<sx:bind id="ex1" href="%{#ajaxTest}" highlightColor="red" afterNotifyTopics="/after" sources="button" events="onclick"/>
<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>
<input type="button" id="button">
<img id="ind1" src="${pageContext.request.contextPath}/images/indicator.gif" style="display:none"/>
<sx:bind href="%{#ajaxTest}" indicator="ind1" errorNotifyTopics="/error" sources="button" events="onclick"/>
| Fields inherited from class org.apache.struts2.dojo.components.AbstractRemoteBean |
afterNotifyTopics, beforeNotifyTopics, errorNotifyTopics, errorText, executeScripts, formFilter, formId, handler, highlightColor, highlightDuration, href, indicator, listenTopics, loadingText, notifyTopics, parseContent, separateScripts, showErrorTransportText, showLoadingText, transport |
| 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 |
|
Constructor Summary |
Bind(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, end, ensureAttributeSafelyNotEscaped, escape, evaluateNameValue, evaluateParams, getId, getTemplate, getTemplateDir, getTooltipConfig, getValueClassType, mergeTemplate, populateComponentHtmlId, setAccesskey, setClass, setCssErrorClass, setCssErrorStyle, setDefaultTemplateDir, setDefaultUITheme, setDisabled, setDynamicAttributes, setErrorPosition, setJavascriptTooltip, setKey, setLabel, 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, setValue |
| 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, setActionMapper, setDevMode, setThrowExceptionsOnELFailure, setUrlHelper, stripExpressionIfAltSyntax, toString, usesBody |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TEMPLATE
public static final String TEMPLATE
- See Also:
- Constant Field Values
OPEN_TEMPLATE
public static final String OPEN_TEMPLATE
- See Also:
- Constant Field Values
targets
protected String targets
sources
protected String sources
events
protected String events
Bind
public Bind(com.opensymphony.xwork2.util.ValueStack stack,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
getDefaultOpenTemplate
public String getDefaultOpenTemplate()
- Specified by:
getDefaultOpenTemplate in class ClosingUIBean
getDefaultTemplate
protected String getDefaultTemplate()
- Specified by:
getDefaultTemplate in class UIBean
evaluateExtraParams
public void evaluateExtraParams()
- Overrides:
evaluateExtraParams in class AbstractValidateBean
setEvents
public void setEvents(String events)
setSources
public void setSources(String sources)
setTargets
public void setTargets(String targets)
setTheme
public void setTheme(String theme)
- Overrides:
setTheme in class AbstractRemoteBean
getTheme
public String getTheme()
- Overrides:
getTheme in class AbstractRemoteBean
setListenTopics
public void setListenTopics(String listenTopics)
- Specified by:
setListenTopics in interface RemoteBean- Overrides:
setListenTopics in class AbstractRemoteBean
setHref
public void setHref(String href)
- Specified by:
setHref in interface RemoteBean- Overrides:
setHref in class AbstractRemoteBean
setErrorText
public void setErrorText(String errorText)
- Specified by:
setErrorText in interface RemoteBean- Overrides:
setErrorText in class AbstractRemoteBean
setExecuteScripts
public void setExecuteScripts(String executeScripts)
- Specified by:
setExecuteScripts in interface RemoteBean- Overrides:
setExecuteScripts in class AbstractRemoteBean
setLoadingText
public void setLoadingText(String loadingText)
- Specified by:
setLoadingText in interface RemoteBean- Overrides:
setLoadingText in class AbstractRemoteBean
setHandler
public void setHandler(String handler)
- Specified by:
setHandler in interface RemoteBean- Overrides:
setHandler in class AbstractRemoteBean
setFormFilter
public void setFormFilter(String formFilter)
- Specified by:
setFormFilter in interface RemoteBean- Overrides:
setFormFilter in class AbstractRemoteBean
setFormId
public void setFormId(String formId)
- Specified by:
setFormId in interface RemoteBean- Overrides:
setFormId in class AbstractRemoteBean
setNotifyTopics
public void setNotifyTopics(String notifyTopics)
- Specified by:
setNotifyTopics in interface RemoteBean- Overrides:
setNotifyTopics in class AbstractRemoteBean
setShowErrorTransportText
public void setShowErrorTransportText(String showError)
- Specified by:
setShowErrorTransportText in interface RemoteBean- Overrides:
setShowErrorTransportText in class AbstractRemoteBean
setIndicator
public void setIndicator(String indicator)
- Specified by:
setIndicator in interface RemoteBean- Overrides:
setIndicator in class AbstractRemoteBean
setShowLoadingText
public void setShowLoadingText(String showLoadingText)
- Specified by:
setShowLoadingText in interface RemoteBean- Overrides:
setShowLoadingText in class AbstractRemoteBean
setCssClass
public void setCssClass(String cssClass)
- Specified by:
setCssClass in interface RemoteBean- Overrides:
setCssClass in class AbstractRemoteBean
setCssStyle
public void setCssStyle(String cssStyle)
- Specified by:
setCssStyle in interface RemoteBean- Overrides:
setCssStyle in class AbstractRemoteBean
setName
public void setName(String name)
- Specified by:
setName in interface RemoteBean- Overrides:
setName in class AbstractRemoteBean
setAfterNotifyTopics
public void setAfterNotifyTopics(String afterNotifyTopics)
- Specified by:
setAfterNotifyTopics in interface RemoteBean- Overrides:
setAfterNotifyTopics in class AbstractRemoteBean
setBeforeNotifyTopics
public void setBeforeNotifyTopics(String beforeNotifyTopics)
- Specified by:
setBeforeNotifyTopics in interface RemoteBean- Overrides:
setBeforeNotifyTopics in class AbstractRemoteBean
setErrorNotifyTopics
public void setErrorNotifyTopics(String errorNotifyTopics)
- Specified by:
setErrorNotifyTopics in interface RemoteBean- Overrides:
setErrorNotifyTopics in class AbstractRemoteBean
setId
public void setId(String id)
- Overrides:
setId in class AbstractRemoteBean
setHighlightColor
public void setHighlightColor(String highlightColor)
- Specified by:
setHighlightColor in interface RemoteBean- Overrides:
setHighlightColor in class AbstractRemoteBean
setHighlightDuration
public void setHighlightDuration(String highlightDuration)
- Specified by:
setHighlightDuration in interface RemoteBean- Overrides:
setHighlightDuration in class AbstractRemoteBean
setValidate
public void setValidate(String validate)
- Overrides:
setValidate in class AbstractValidateBean
setAjaxAfterValidation
public void setAjaxAfterValidation(String ajaxAfterValidation)
- Overrides:
setAjaxAfterValidation in class AbstractValidateBean
setSeparateScripts
public void setSeparateScripts(String separateScripts)
- Specified by:
setSeparateScripts in interface RemoteBean- Overrides:
setSeparateScripts in class AbstractRemoteBean
setTransport
public void setTransport(String transport)
- Specified by:
setTransport in interface RemoteBean- Overrides:
setTransport in class AbstractRemoteBean
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.