Save This Page
Home » struts-2.1.8.1-src » org.apache.struts2.dojo » components » [javadoc | source]
org.apache.struts2.dojo.components
public class: Anchor [javadoc | source]
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.Anchor

All Implemented Interfaces:
    RemoteBean

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
public static final  String OPEN_TEMPLATE     
public static final  String TEMPLATE     
public static final  String COMPONENT_NAME     
protected  String targets     
Fields inherited from org.apache.struts2.dojo.components.AbstractValidateBean:
validate,  ajaxAfterValidation
Fields inherited from org.apache.struts2.dojo.components.AbstractRemoteBean:
href,  errorText,  executeScripts,  loadingText,  listenTopics,  handler,  formId,  formFilter,  notifyTopics,  showErrorTransportText,  indicator,  showLoadingText,  beforeNotifyTopics,  afterNotifyTopics,  errorNotifyTopics,  highlightColor,  highlightDuration,  separateScripts,  transport,  parseContent
Fields inherited from org.apache.struts2.components.ClosingUIBean:
openTemplate
Fields inherited from org.apache.struts2.components.UIBean:
request,  response,  templateSuffix,  template,  templateDir,  theme,  key,  id,  cssClass,  cssStyle,  cssErrorClass,  cssErrorStyle,  disabled,  label,  labelPosition,  labelSeparator,  requiredposition,  name,  required,  tabindex,  value,  title,  onclick,  ondblclick,  onmousedown,  onmouseup,  onmouseover,  onmousemove,  onmouseout,  onfocus,  onblur,  onkeypress,  onkeydown,  onkeyup,  onselect,  onchange,  accesskey,  tooltip,  tooltipConfig,  javascriptTooltip,  tooltipDelay,  tooltipCssClass,  tooltipIconPath,  dynamicAttributes,  defaultTemplateDir,  defaultUITheme,  templateEngineManager
Fields inherited from org.apache.struts2.components.Component:
COMPONENT_STACK,  stack,  parameters,  actionMapper,  throwExceptionOnELFailure
Constructor:
 public Anchor(ValueStack stack,
    HttpServletRequest request,
    HttpServletResponse response) 
Method from org.apache.struts2.dojo.components.Anchor Summary:
evaluateExtraParams,   getDefaultOpenTemplate,   getDefaultTemplate,   setTargets,   setTheme
Methods from org.apache.struts2.dojo.components.AbstractValidateBean:
evaluateExtraParams,   setAjaxAfterValidation,   setValidate
Methods from org.apache.struts2.dojo.components.AbstractRemoteBean:
evaluateExtraParams,   getTheme,   setAfterNotifyTopics,   setBeforeNotifyTopics,   setCssClass,   setCssStyle,   setErrorNotifyTopics,   setErrorText,   setExecuteScripts,   setFormFilter,   setFormId,   setHandler,   setHighlightColor,   setHighlightDuration,   setHref,   setId,   setIndicator,   setListenTopics,   setLoadingText,   setName,   setNotifyTopics,   setParseContent,   setSeparateScripts,   setShowErrorTransportText,   setShowLoadingText,   setTheme,   setTransport
Methods from org.apache.struts2.components.ClosingUIBean:
getDefaultOpenTemplate,   setOpenTemplate,   start
Methods from org.apache.struts2.components.UIBean:
addFormParameter,   buildTemplateName,   enableAncestorFormCustomOnsubmit,   end,   ensureAttributeSafelyNotEscaped,   escape,   evaluateExtraParams,   evaluateNameValue,   evaluateParams,   getDefaultTemplate,   getId,   getTemplate,   getTemplateDir,   getTheme,   getTooltipConfig,   getValueClassType,   mergeTemplate,   populateComponentHtmlId,   setAccesskey,   setCssClass,   setCssErrorClass,   setCssErrorStyle,   setCssStyle,   setDefaultTemplateDir,   setDefaultUITheme,   setDisabled,   setDynamicAttributes,   setId,   setJavascriptTooltip,   setKey,   setLabel,   setLabelSeparator,   setLabelposition,   setName,   setOnblur,   setOnchange,   setOnclick,   setOndblclick,   setOnfocus,   setOnkeydown,   setOnkeypress,   setOnkeyup,   setOnmousedown,   setOnmousemove,   setOnmouseout,   setOnmouseover,   setOnmouseup,   setOnselect,   setRequired,   setRequiredposition,   setTabindex,   setTemplate,   setTemplateDir,   setTemplateEngineManager,   setTheme,   setTitle,   setTooltip,   setTooltipConfig,   setTooltipCssClass,   setTooltipDelay,   setTooltipIconPath,   setValue
Methods from org.apache.struts2.components.Component:
addAllParameters,   addParameter,   altSyntax,   altSyntax,   completeExpressionIfAltSyntax,   copyParams,   determineActionURL,   determineNamespace,   end,   end,   fieldError,   findAncestor,   findString,   findString,   findStringIfAltSyntax,   findValue,   findValue,   findValue,   getComponentStack,   getParameters,   getStack,   popComponentStack,   setActionMapper,   setThrowExceptionsOnELFailure,   start,   stripExpressionIfAltSyntax,   stripExpressionIfAltSyntax,   toString,   usesBody
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.struts2.dojo.components.Anchor Detail:
 public  void evaluateExtraParams() 
 public String getDefaultOpenTemplate() 
 protected String getDefaultTemplate() 
 public  void setTargets(String targets) 
 public  void setTheme(String theme)