org.loom.tags.core
Class UrlTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.SimpleTagSupport
      extended by org.loom.tags.AbstractTag
          extended by org.loom.tags.AbstractDecoratedTag
              extended by org.loom.tags.AbstractHtmlTag
                  extended by org.loom.tags.core.UrlTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.DynamicAttributes, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag, HtmlTag, Link, LoomTag, ParameterContainer

@Tag(dynamicAttributes=true,
     bodyContent=SCRIPTLESS,
     example="<l:url action=\"BlogEntries\" event=\"open\" param-foo=\"${foo}\"/>\n<l:url mapping=\"BlogEntries.open\" />\n<l:url href=\"/foo/bar\">Click here</l:url>")
public class UrlTag
extends AbstractHtmlTag
implements Link, ParameterContainer

HTML link. Creates a link to a URL or a Action / event pair. If the tag has a body, renders a HTML link around it. Else, it will use the title attribute as a body. To render just a link, use l:link instead


Field Summary
 
Fields inherited from class org.loom.tags.AbstractDecoratedTag
decorator
 
Fields inherited from class org.loom.tags.AbstractTag
expressionLanguageProxy, loomServletRequestFactory, out, repository, request, response
 
Constructor Summary
UrlTag()
           
 
Method Summary
 UrlTag addParameter(java.lang.String name, java.lang.Object value)
          Adds a parameter to the resulting url
 void doTagImpl()
          The method that must be implemented by the child class
 HttpMethod getMethod()
           
 java.lang.Integer getTabindex()
           
 UrlBuilder getUrl()
           
protected  void initTag()
          Initializes the tag attributes
 boolean isEncodeParameters()
           
 void setAction(java.lang.String action)
          The action this link points to.
 void setCharset(java.lang.String charset)
           
 void setEncodeParameters(boolean encodeParameters)
           
 void setEvent(java.lang.String event)
          The event this link points to.
 void setHash(java.lang.String hash)
          The hash of the url (the fragment after '#')
 void setHostname(java.lang.String serverName)
          The server name to use.
 void setHref(java.lang.String href)
          HTML attribute The target url.
 void setHreflang(java.lang.String hreflang)
           
 void setMapping(java.lang.String mapping)
          The mapping as action.event.
 void setMethod(HttpMethod method)
          Set the HttpMethod of this link.
 void setPort(java.lang.Integer port)
          The port to use.
 void setRel(java.lang.String rel)
           
 void setRelative(boolean relative)
          true if the url is relative (do not render schema, server or port), false to render a full URL.
 void setRequest(LoomServletRequest request)
           
 void setRev(java.lang.String rev)
           
 void setScheme(java.lang.String scheme)
          The scheme to use.
 void setScope(java.lang.String scope)
          If var is not null, this is the scope where the value will be stored.
 void setShape(java.lang.String shape)
           
 void setTabindex(java.lang.Integer tabindex)
           
 void setTarget(java.lang.String target)
           
 void setType(java.lang.String type)
           
 void setUrl(UrlBuilder url)
           
 void setVar(java.lang.String var)
           
 
Methods inherited from class org.loom.tags.AbstractHtmlTag
addCssClass, getAccesskey, getCssBuilder, getCssClass, getDir, getId, getLang, getName, getStyle, getTitle, getTranslatedTitle, identify, isCssProcessed, isIf, isTranslateTitle, printParentAttributes, renderTag, setAccesskey, setCssClass, setCssProcessed, setDir, setId, setIf, setLang, setName, setStyle, setTitle, setTranslateTitle
 
Methods inherited from class org.loom.tags.AbstractDecoratedTag
doTag, getDecorator, getDecoratorInstance, setDecorator
 
Methods inherited from class org.loom.tags.AbstractTag
createWriterWrapper, doBody, doBufferedBody, endTag, evaluateExpression, getActionProperty, getAncestorWithClass, getBufferedBody, getExtendedAttributes, getMessagesRepository, getPageContext, getRequest, getResponse, getScopedAttribute, getWriter, removeScopedAttribute, setDynamicAttribute, setExtendedAttribute, setJspContext, setResponse, setScopedAttribute, setWriter
 
Methods inherited from class javax.servlet.jsp.tagext.SimpleTagSupport
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.loom.tags.HtmlTag
addCssClass, getCssBuilder
 
Methods inherited from interface org.loom.tags.LoomTag
getExtendedAttributes, getRequest, getScopedAttribute, setExtendedAttribute, setScopedAttribute
 

Constructor Detail

UrlTag

public UrlTag()
Method Detail

setRequest

public void setRequest(LoomServletRequest request)
Overrides:
setRequest in class AbstractTag

initTag

protected void initTag()
Description copied from class: AbstractTag
Initializes the tag attributes

Overrides:
initTag in class AbstractTag

doTagImpl

public void doTagImpl()
               throws javax.servlet.jsp.JspException,
                      java.io.IOException
Description copied from class: AbstractTag
The method that must be implemented by the child class

Specified by:
doTagImpl in class AbstractTag
Throws:
javax.servlet.jsp.JspException
java.io.IOException

setScope

@Attribute
public void setScope(java.lang.String scope)
If var is not null, this is the scope where the value will be stored. Possible values are page (default), request, session and application.


setAction

@Attribute
public void setAction(java.lang.String action)
The action this link points to. Either this or href must be specified


setEvent

@Attribute
public void setEvent(java.lang.String event)
The event this link points to. If action is specified but event is not, the default event will be assumed. If the action does not define a default event, an exception will be thrown. Either action/event or href must be set.


setRelative

@Attribute
public void setRelative(boolean relative)
true if the url is relative (do not render schema, server or port), false to render a full URL. Default is true


setScheme

@Attribute
public void setScheme(java.lang.String scheme)
The scheme to use. If not specified, the current request scheme will be used.

Parameters:
scheme - the scheme to use. Examples are: "http", "https"

setHostname

@Attribute
public void setHostname(java.lang.String serverName)
The server name to use. If not specified, the current request.getServerName() value will be used.


setPort

@Attribute
public void setPort(java.lang.Integer port)
The port to use. If not specified, the current request port will be used.

Parameters:
port - the port to use. Examples are: 80, 443

setMapping

@Attribute
public void setMapping(java.lang.String mapping)
The mapping as action.event. This method is equivalent to setting action and event separately.


setHash

@Attribute
public void setHash(java.lang.String hash)
The hash of the url (the fragment after '#')


setHref

@Attribute
public void setHref(java.lang.String href)
HTML attribute The target url. Either this or the action / event pair must be set.


setCharset

public void setCharset(java.lang.String charset)

setHreflang

public void setHreflang(java.lang.String hreflang)

setRel

public void setRel(java.lang.String rel)

setRev

public void setRev(java.lang.String rev)

setShape

public void setShape(java.lang.String shape)

setTarget

public void setTarget(java.lang.String target)

setType

public void setType(java.lang.String type)

setVar

public void setVar(java.lang.String var)

addParameter

public UrlTag addParameter(java.lang.String name,
                           java.lang.Object value)
Description copied from interface: ParameterContainer
Adds a parameter to the resulting url

Specified by:
addParameter in interface ParameterContainer
Parameters:
name - the name of the parameter
value - the value of the parameter
Returns:
the same instance of ParameterContainer, to allow nested calls.

getUrl

public UrlBuilder getUrl()
Specified by:
getUrl in interface Link
Returns:
the target url of this link

setUrl

public void setUrl(UrlBuilder url)

getMethod

public HttpMethod getMethod()
Specified by:
getMethod in interface Link
Returns:
the HttpMethod of this link. If null, GET will be used

setMethod

public void setMethod(HttpMethod method)
Description copied from interface: Link
Set the HttpMethod of this link. / If specified (and != GET), be aware that you should setup the javascript needed to actually perform the POST call. Browsers without javascript enabled (such as web crawlers, or normal browsers with ctrl+click) will ignore this and perform a GET call that should be accepted and i.e. get this same HTML page.

Specified by:
setMethod in interface Link

isEncodeParameters

public boolean isEncodeParameters()

setEncodeParameters

public void setEncodeParameters(boolean encodeParameters)

setTabindex

public void setTabindex(java.lang.Integer tabindex)

getTabindex

public java.lang.Integer getTabindex()