Version 4.10.0

hirondelle.web4j.ui.tag
Class TagHelper

Object
  extended by SimpleTagSupport
      extended by hirondelle.web4j.ui.tag.TagHelper
All Implemented Interfaces:
JspTag, SimpleTag
Direct Known Subclasses:
AlternatingRow, HighlightCurrentPage, Messages, Pager, Populate, ShowDate, ShowDateTime, ShowForRole, Text, TextFlow, Tooltips

public abstract class TagHelper
extends SimpleTagSupport

Base class for implementing custom JSP tags.

The custom tag can optionally have a body. The .tld entry for these tags must have their body-content set to scriptless.

Concrete subclasses of this class perform these tasks :


Constructor Summary
TagHelper()
           
 
Method Summary
protected  void checkForContent(String aAttributeName, String aAttributeValue)
          Verify that an attribute value has content.
protected  void crossCheckAttributes()
          Perform validations that apply to more than one attribute.
 void doTag()
          Template method which calls getEmittedText(String).
protected abstract  String getEmittedText(String aOriginalBody)
          Return the text this tag will display in the resulting web page.
protected  PageContext getPageContext()
          Return the underlying PageContext.
protected  String getPageName()
          Return the name of the JSP implementation class.
protected  HttpServletRequest getRequest()
          Return the underlying HttpServletRequest.
protected  HttpServletResponse getResponse()
          Return the underlying HttpServletResponse.
 
Methods inherited from class SimpleTagSupport
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext, setParent
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TagHelper

public TagHelper()
Method Detail

doTag

public final void doTag()
                 throws JspException
Template method which calls getEmittedText(String).

The body of this tag is evaluated, passed to getEmittedText(String), and the result is then written to the JSP output writer. In addition, this method will call crossCheckAttributes() at the start of processing.

Specified by:
doTag in interface SimpleTag
Overrides:
doTag in class SimpleTagSupport
Throws:
JspException

getEmittedText

protected abstract String getEmittedText(String aOriginalBody)
                                  throws JspException,
                                         IOException
Return the text this tag will display in the resulting web page.

Parameters:
aOriginalBody - is the evaluated body of this tag. If there is no body, or if the body is present but empty, then it is null.
Returns:
the text to display in the resulting web page.
Throws:
JspException
IOException

crossCheckAttributes

protected void crossCheckAttributes()
Perform validations that apply to more than one attribute.

This default implementation does nothing.

Validations that apply to a single attribute should be performed in its corresponding setXXX method.

If a problem is detected, subclasses must emit a RuntimeException describing the problem. If all validations apply to only to a single attribute, then this method should not be overridden.


getRequest

protected final HttpServletRequest getRequest()
Return the underlying HttpServletRequest.


getResponse

protected final HttpServletResponse getResponse()
Return the underlying HttpServletResponse.


getPageContext

protected final PageContext getPageContext()
Return the underlying PageContext.


getPageName

protected final String getPageName()
Return the name of the JSP implementation class.

Intended for debugging only.


checkForContent

protected final void checkForContent(String aAttributeName,
                                     String aAttributeValue)
Verify that an attribute value has content.

If no content, then log at SEVERE and throw an unchecked exception.


Version 4.10.0

Copyright Hirondelle Systems. Published October 19, 2013 - User Guide - All Docs.