com.opensymphony.webwork.components
Class Anchor

java.lang.Object
  extended by com.opensymphony.webwork.components.Component
      extended by com.opensymphony.webwork.components.UIBean
          extended by com.opensymphony.webwork.components.ClosingUIBean
              extended by com.opensymphony.webwork.components.RemoteCallUIBean
                  extended by com.opensymphony.webwork.components.Anchor

public class Anchor
extends RemoteCallUIBean

A tag that creates a HTML <a href='' /> that when clicked calls a URL remote XMLHttpRequest call via the dojo framework. The result from the URL is executed as JavaScript. If a "listenTopics" is supplied, it will publish a 'click' message to that topic when the result is returned.

Examples

 
 <ww:a id="link1" theme="ajax" href="/DoIt.action" errorText="An error ocurred" showErrorTransportText="true">
     <img border="none" src="<%=request.getContextPath()%>/images/delete.gif"/>
     <ww:param name="id" value="1"/>
 </ww:a>
 
 

Results in

 
 <a dojoType="BindAnchor" evalResult="true" id="link1" href="/DoIt.action?id=1" errorHtml="An error ocurred"
 showTransportError="true"></a>
 
 

Here is an example that uses the postInvokeJS. This example is in altSyntax=true:

 
 <ww:a id="test" theme="ajax" href="/simpeResult.action" preInvokeJS="confirm(\'You sure\')">
        A
 </ww:a>
 
 

Since:
2.2
Version:
$Revision: 2468 $
Author:
Ian Roughley, Rene Gielen

Field Summary
static String COMPONENT_NAME
           
protected  String notifyTopics
           
static String OPEN_TEMPLATE
           
protected  String preInvokeJS
           
static String TEMPLATE
           
 
Fields inherited from class com.opensymphony.webwork.components.RemoteCallUIBean
afterLoading, errorText, href, showErrorTransportText
 
Fields inherited from class com.opensymphony.webwork.components.UIBean
accesskey, cssClass, cssStyle, disabled, label, labelPosition, name, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, request, required, requiredposition, response, tabindex, template, templateDir, templateSuffix, theme, title, tooltip, tooltipConfig, value
 
Fields inherited from class com.opensymphony.webwork.components.Component
COMPONENT_STACK, id, parameters, stack
 
Constructor Summary
Anchor(OgnlValueStack stack, HttpServletRequest request, HttpServletResponse response)
           
 
Method Summary
 void evaluateExtraParams()
           
 String getDefaultOpenTemplate()
           
protected  String getDefaultTemplate()
          A contract that requires each concrete UI Tag to specify which template should be used as a default.
 void setId(String id)
          The id to assign the component
 void setNotifyTopics(String notifyTopics)
          Topic names to post an event to after the remote call has been made
 void setPreInvokeJS(String preInvokeJS)
          A javascript snippet that will be invoked prior to the execution of the target href.
 
Methods inherited from class com.opensymphony.webwork.components.RemoteCallUIBean
setAfterLoading, setErrorText, setHref, setShowErrorTransportText, setTheme
 
Methods inherited from class com.opensymphony.webwork.components.ClosingUIBean
setOpenTemplate, start
 
Methods inherited from class com.opensymphony.webwork.components.UIBean
addFormParameter, buildTemplateName, enableAncestorFormCustomOnsubmit, end, escape, evaluateNameValue, evaluateParams, getTemplate, getTemplateDir, getTheme, getTooltipConfig, getValueClassType, mergeTemplate, populateComponentHtmlId, setAccesskey, setCssClass, setCssStyle, setDisabled, setLabel, setLabelposition, setLabelPosition, setName, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setRequired, setRequiredposition, setTabindex, setTemplate, setTemplateDir, setTitle, setTooltip, setTooltipConfig, setValue
 
Methods inherited from class com.opensymphony.webwork.components.Component
addAllParameters, addParameter, altSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findValue, findValue, findValue, getComponentStack, getId, getParameters, getStack, popComponentStack, 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 String OPEN_TEMPLATE
See Also:
Constant Field Values

TEMPLATE

public static final String TEMPLATE
See Also:
Constant Field Values

COMPONENT_NAME

public static final String COMPONENT_NAME

notifyTopics

protected String notifyTopics

preInvokeJS

protected String preInvokeJS
Constructor Detail

Anchor

public Anchor(OgnlValueStack stack,
              HttpServletRequest request,
              HttpServletResponse response)
Method Detail

getDefaultOpenTemplate

public String getDefaultOpenTemplate()
Specified by:
getDefaultOpenTemplate in class ClosingUIBean

getDefaultTemplate

protected String getDefaultTemplate()
Description copied from class: UIBean
A contract that requires each concrete UI Tag to specify which template should be used as a default. For example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm". This value not begin with a '/' unless you intend to make the path absolute rather than relative to the current theme.

Specified by:
getDefaultTemplate in class UIBean
Returns:
The name of the template to be used as the default.

evaluateExtraParams

public void evaluateExtraParams()
Overrides:
evaluateExtraParams in class RemoteCallUIBean

setId

public void setId(String id)
The id to assign the component

Overrides:
setId in class Component

setNotifyTopics

public void setNotifyTopics(String notifyTopics)
Topic names to post an event to after the remote call has been made


setPreInvokeJS

public void setPreInvokeJS(String preInvokeJS)
A javascript snippet that will be invoked prior to the execution of the target href. If provided must return true or false. True indicates to continue executing target, false says do not execute link target. Possible uses are for confirm dialogs.


WebWork Project Page