public class ObjectAnchorTag extends AbstractObjectTag
Renders an HTML anchor tag to a page or page type using the attributes provided. Correct usage of this tag should include a body that will be rendered as the link - if no body is provided then nothing acionable will be rendered on the screen.
| Constructor and Description |
|---|
ObjectAnchorTag() |
| Modifier and Type | Method and Description |
|---|---|
int |
doEndTag()
Closes the HTML anchor tag opened in
doStartTag |
String |
getTarget() |
protected int |
invokeRenderService(RenderService renderService,
RequestContext requestContext,
ModelObject object)
Generates the URL to the requested resource (either a page or page type with optional object and format
request parameters) and then opens an HTML anchor tag using the generated URL as the HREF argument and setting
a target if provided.
|
void |
release()
The life-cycle of a custom JSP tag is that the class is is instantiated when it is first required and
then re-used for all subsequent invocations.
|
void |
setTarget(String target) |
getFormat, getObject, getPage, getPageType, setFormat, setObject, setPage, setPageTypedoStartTagInternaldoCatch, doFinally, doStartTag, getRequestContextpublic void setTarget(String target)
public String getTarget()
public void release()
The life-cycle of a custom JSP tag is that the class is is instantiated when it is first required and
then re-used for all subsequent invocations. When a JSP has non-mandatory properties it means that the
setters for those properties will not be called if the properties are not provided and the old values
will still be available which can corrupt the behaviour of the code. In order to prevent this from happening
we should override the release method to ensure that all instance variables are reset to their
initial state.
release in interface javax.servlet.jsp.tagext.Tagrelease in class AbstractObjectTagprotected int invokeRenderService(RenderService renderService, RequestContext requestContext, ModelObject object) throws Exception
Generates the URL to the requested resource (either a page or page type with optional object and format
request parameters) and then opens an HTML anchor tag using the generated URL as the HREF argument and setting
a target if provided. The body is then evaluated (which should render something to display as a link) and the
doEndTag method will close the HTML anchor tag.
invokeRenderService in class RenderServiceTagrenderService - RenderServicerequestContext - RequestContextobject - ModelObjectjavax.servlet.jsp.JspException - wrapping any IOException that may occur writing the output.Exceptionpublic int doEndTag()
throws javax.servlet.jsp.JspException
Closes the HTML anchor tag opened in doStartTag
doEndTag in interface javax.servlet.jsp.tagext.TagdoEndTag in class javax.servlet.jsp.tagext.TagSupportjavax.servlet.jsp.JspExceptionCopyright © 2005–2016 Alfresco Software. All rights reserved.