jp.terasoluna.fw.web.taglib
Class WriteCodeCountTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by jp.terasoluna.fw.web.taglib.WriteCodeCountTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class WriteCodeCountTag
extends javax.servlet.jsp.tagext.TagSupport

Implementation class of writeCodeCount tag.

Returns the size of code list.
From the servlet context, seraches the CodeListLoader which is specified by (id), fetches the codelist stored in it and returns the size of that codelist. If it is not found, returns the size as 0.

Attribute supported by tag

writeCodeCount tag supports the following attributes.

Attribute name Defafult value Required Execution time format Overview
id - true true From this attribute, searches the code list loader that contains the code list. In other words, specify the name of bean which implements CodeListLoader interface. Returns 0 when code list is not found.

Scripting variable of custom tag

There is no scripting variable set by this tag.


How to use
In the following configuration example, bean of the class in which CodeListLoader interface is implemented, is defined with the name as "loader1" and used.
For the method of defining, refer to DBCodeListLoader, and MappedCodeListLoader .

Example of description in JSP.

  ...
  <t:writeCodeCount id="loader1" />
  ...
 
To fetch the code list, refer to DefineCodeListTag.

See Also:
DBCodeListLoader, MappedCodeListLoader, DefineCodeListTag, Serialized Form

Field Summary
private static org.apache.commons.logging.Log log
          Log class.
private static long serialVersionUID
          Serial version ID
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
WriteCodeCountTag()
           
 
Method Summary
 int doEndTag()
          Method which is called at the time of terminating the tag evaluation.
 int doStartTag()
          Method which is called at the time of starting the tag evaluation.
 void release()
          Process at the time of releasing the tag handler.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial version ID

See Also:
Constant Field Values

log

private static org.apache.commons.logging.Log log
Log class.

Constructor Detail

WriteCodeCountTag

public WriteCodeCountTag()
Method Detail

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Method which is called at the time of starting the tag evaluation.

Searches the code list loader from the servlet context. If the code list is found, returns the element count of code list. When the code list is not found, writes 0 on the screen.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.TagSupport
Returns:
Process control instructions. Always EVAL_BODY_INCLUDE
Throws:
javax.servlet.jsp.JspException - JSPException

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Method which is called at the time of terminating the tag evaluation.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.TagSupport
Returns:
Process control instructions. Always EVAL_PAGE
Throws:
javax.servlet.jsp.JspException - JSP exception

release

public void release()
Process at the time of releasing the tag handler.

Specified by:
release in interface javax.servlet.jsp.tagext.Tag
Overrides:
release in class javax.servlet.jsp.tagext.TagSupport