org.apache.struts2.dojo.components
Class Anchor

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.dojo.components.AbstractRemoteBean
                  extended by org.apache.struts2.dojo.components.AbstractValidateBean
                      extended by org.apache.struts2.dojo.components.Anchor
All Implemented Interfaces:
RemoteBean

public class Anchor
extends AbstractValidateBean

A tag that creates an HTML <a/> element, that when clicked makes an asynchronous request(XMLHttpRequest). The url attribute must be build using the <s:url/> tag.

Examples

<div id="div1">Div 1</div> <s:url id="ajaxTest" value="/AjaxTest.action"/> <sx:a id="link1" href="%{ajaxTest}" target="div1"> Update Content </sx:a> <s:form id="form" action="AjaxTest"> <input type="textbox" name="data"> <sx:a>Submit form</sx:a> </s:form> <s:form id="form" action="AjaxTest"> <input type="textbox" name="data"> </s:form> <sx:a formId="form">Submit form</sx:a> <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:a beforeNotifyTopics="/before">Publish topics</sx:a> <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:a afterNotifyTopics="/after" highlightColor="red" href="%{#ajaxTest}">Publish topics</sx:a> <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:a errorNotifyTopics="/error" indicator="ind1" href="%{#ajaxTest}">Publish topics</sx:a>


Field Summary
static java.lang.String COMPONENT_NAME
           
static java.lang.String OPEN_TEMPLATE
           
protected  java.lang.String targets
           
static java.lang.String TEMPLATE
           
 
Fields inherited from class org.apache.struts2.dojo.components.AbstractValidateBean
ajaxAfterValidation, validate
 
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, 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
 
Fields inherited from class org.apache.struts2.components.Component
actionMapper, COMPONENT_STACK, parameters, stack
 
Constructor Summary
Anchor(com.opensymphony.xwork2.util.ValueStack stack, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Method Summary
 void evaluateExtraParams()
           
 java.lang.String getDefaultOpenTemplate()
           
protected  java.lang.String getDefaultTemplate()
           
 void setTargets(java.lang.String targets)
           
 void setTheme(java.lang.String theme)
           
 
Methods inherited from class org.apache.struts2.dojo.components.AbstractValidateBean
setAjaxAfterValidation, setValidate
 
Methods inherited from class org.apache.struts2.dojo.components.AbstractRemoteBean
getTheme, setAfterNotifyTopics, setBeforeNotifyTopics, setCssClass, setCssStyle, setErrorNotifyTopics, setErrorText, setExecuteScripts, setFormFilter, setFormId, setHandler, setHighlightColor, setHighlightDuration, setHref, setId, setIndicator, setListenTopics, setLoadingText, setName, setNotifyTopics, setParseContent, setSeparateScripts, setShowErrorTransportText, setShowLoadingText, setTransport
 
Methods inherited from class org.apache.struts2.components.ClosingUIBean
setOpenTemplate, start
 
Methods inherited from class org.apache.struts2.components.UIBean
addFormParameter, buildTemplateName, enableAncestorFormCustomOnsubmit, end, ensureAttributeSafelyNotEscaped, escape, evaluateNameValue, evaluateParams, getId, getTemplate, getTemplateDir, getTooltipConfig, getValueClassType, mergeTemplate, populateComponentHtmlId, setAccesskey, setCssErrorClass, setCssErrorStyle, setDefaultTemplateDir, setDefaultUITheme, setDisabled, setDynamicAttributes, setJavascriptTooltip, setKey, setLabel, 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, setValue
 
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, setActionMapper, stripExpressionIfAltSyntax, 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 java.lang.String OPEN_TEMPLATE
See Also:
Constant Field Values

TEMPLATE

public static final java.lang.String TEMPLATE
See Also:
Constant Field Values

COMPONENT_NAME

public static final java.lang.String COMPONENT_NAME

targets

protected java.lang.String targets
Constructor Detail

Anchor

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

getDefaultOpenTemplate

public java.lang.String getDefaultOpenTemplate()
Specified by:
getDefaultOpenTemplate in class org.apache.struts2.components.ClosingUIBean

getDefaultTemplate

protected java.lang.String getDefaultTemplate()
Specified by:
getDefaultTemplate in class org.apache.struts2.components.UIBean

evaluateExtraParams

public void evaluateExtraParams()
Overrides:
evaluateExtraParams in class AbstractValidateBean

setTheme

public void setTheme(java.lang.String theme)
Overrides:
setTheme in class AbstractRemoteBean

setTargets

public void setTargets(java.lang.String targets)


Copyright © 2000-2009 Apache Software Foundation. All Rights Reserved.