jp.terasoluna.fw.web.taglib
Class WriteTag

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

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

Implementation class of write tag that converts the value of specified bean property and specifies it as the JspWriter.

Retrieve the specified bean property value and assign it to the current JspWriter as a String. If there is a PropertyEditor which is configured for the property value class, getAsText() method is called. Other than that, normal toString() conversion is used or as shown below, the additional conversion is performed through the attributes.

  • Replace null or blank character with " "
  • Replace half-width space with " "
  • Replace line feed code with <br>
  • Ignore line feed character

  • Attribute supported by tag
  • In write tag, following attributes are supported.


  • Attribute name Default value Required Execution time format Overview
    filter - false true When this attribute is set to true, specified property value is filtered in HTML since it consists of sensitive characters. All such characters are replaced with equivalent characters. Filtering is performed by default. To nullify, set "False" explicitly in this attribute.
    replaceNullToNbsp - false true This attribute is set to "true" and when the specified bean property value is blank character or null, &nbsp; is output. To nullify, set "False" explicitly in this attribute.
    replaceSpToNbsp - false true This attribute is set to "true". When specified bean property value consists of 1 Byte code space, it is replaced with &nbsp;. To nullify, set "False" explicitly in this attribute.
    replaceLFtoBR - false true When this attribute is set to "true", linefeed code or restored characters of specified bean property value are replaced with <br>. To nullify, set "false" explicitly in this attribute.
    ignore - false true This attribute is set to "true" and when the bean specified in name and scope does not exist, it returns without doing any processing. Default value is "false" (At the time of execution, exception is thrown in such a way that this tag will not be consistent with other tags in the library).
    name - true true To retrieve the value specified in property (when it is specified), specify the attribute name of bean in which property is accessed. When the property is not specified, the value of this bean itself is specified.
    property - false true Specify the property name which is accessed in the bean that is specified by "name" attribute. This value is converted to the simple, indexed and nested property reference format. When it is not specified, bean which is identified by "name" attribute is specified. When the specified property returns null, nothing is specified.
    scope - false true Specify the variable scope which is searched to fetch the bean that is specified by "name". When it is not specified, default rules of PageContext.findAttribute() are applied.
    fillColumn - false true Use the characters specified in "fillColumn" as the delimiter and append <br> at the end. The half-width or full-width character is considered as 1 character.
    addBR - false true Whn this attribute is set to "true", append <br> at the end of property value. Default is false.

  • There is no scripting variable set by this tag.

  • How to use

     <logic:iterate id="form"
         property="myMap" indexId="index" >
         <t:write name="form" property="value" />
     </logic:iterate>
     

    See Also:
    Serialized Form

    Field Summary
    protected  boolean addBR
               Append <br> to the end of property value.
    protected  int fillColumn
               Property name which is accessed in the Bean which is specified by fillColumn.
    protected  boolean filter
               Replace the special characters with the HTML characters.
    protected  boolean ignore
               Nothing is performed when the Bean which is specified by name and scope attribute does not exist.
    private static org.apache.commons.logging.Log log
              Log class
    protected  java.lang.String name
               Bean name to fetch te value which is specified in property.
    protected  java.lang.String property
               Property name which is accessed in the Bean which is specified by name.
    protected  boolean replaceLFtoBR
               Replace linefeed code with <br>.
    protected  boolean replaceNullToNbsp
               Replace null or blank character with  .
    protected  boolean replaceSpToNbsp
               Replace half-width space with &nbsp;.
    protected  java.lang.String scope
               Search scope name to fetch the bean which is specified by name.
    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
    WriteTag()
               
     
    Method Summary
     int doStartTag()
              Performs start tag processing.
     boolean getAddBR()
               get method of addBR
     int getFillColumn()
               get method of fillColumn
     boolean getFilter()
               get method of filter
     boolean getIgnore()
               get method of ignore
     java.lang.String getName()
               get method of name
     java.lang.String getProperty()
               get method of property
     boolean getReplaceLFtoBR()
               get method of replaceLFtoBR
     boolean getReplaceNullToNbsp()
               get method of replaceNullToNbsp
     boolean getReplaceSpToNbsp()
               get method of replaceSpToNbsp
     java.lang.String getScope()
               get method of scope
     void release()
              Releases all allocated resources.
     void setAddBR(boolean addBR)
               set method of addBR
     void setFillColumn(int fillColumn)
               set method of fillColumn
     void setFilter(boolean filter)
               set method of filter
     void setIgnore(boolean ignore)
               set method of ignore
     void setName(java.lang.String name)
               set method of name
     void setProperty(java.lang.String property)
               set method of property
     void setReplaceLFtoBR(boolean replaceLFtoBR)
               set method of replaceLFtoBR
     void setReplaceNullToNbsp(boolean replaceNullToNbsp)
               set method of replaceNullToNbsp
     void setReplaceSpToNbsp(boolean replaceSpToNbsp)
               set method of replaceSpToNbsp
     void setScope(java.lang.String scope)
               set method of scope
     
    Methods inherited from class javax.servlet.jsp.tagext.TagSupport
    doAfterBody, doEndTag, 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


    filter

    protected boolean filter

    Replace special characters with HTML characters.


    replaceNullToNbsp

    protected boolean replaceNullToNbsp

    Replace null or blank characters with  .


    replaceSpToNbsp

    protected boolean replaceSpToNbsp

    Replace half-width space with &nbsp;.


    replaceLFtoBR

    protected boolean replaceLFtoBR

    Replace linefeed code with <br>.


    ignore

    protected boolean ignore

    When Bean which is specified by name and scope attribute does not exist, no processing is performed.


    name

    protected java.lang.String name

    Bean name to fetch the value which is specified by property


    property

    protected java.lang.String property

    Property name which is accessed in the Bean which is specified by name.


    scope

    protected java.lang.String scope

    Search scope name to fetch the bean which is specified by name.


    fillColumn

    protected int fillColumn

    Property name which is accessed in the Bean that is specified by fillColumn.


    addBR

    protected boolean addBR

    Append <br> at the end of property value.

    Constructor Detail

    WriteTag

    public WriteTag()
    Method Detail

    getFilter

    public boolean getFilter()

    get method of filter

    Returns:
    filter filter

    setFilter

    public void setFilter(boolean filter)

    set method of filter

    Parameters:
    filter - filter attribute value

    getReplaceNullToNbsp

    public boolean getReplaceNullToNbsp()

    get method of replaceNullToNbsp

    Returns:
    replaceNullToNbsp Replace null with &nbsp; conversion flag

    setReplaceNullToNbsp

    public void setReplaceNullToNbsp(boolean replaceNullToNbsp)

    set method of replaceNullToNbsp

    Parameters:
    replaceNullToNbsp - Replace null with &nbsp; conversion flag

    getReplaceSpToNbsp

    public boolean getReplaceSpToNbsp()

    get method of replaceSpToNbsp

    Returns:
    replaceSpToNbsp Replace half-width space with &nbsp;conversion flag

    setReplaceSpToNbsp

    public void setReplaceSpToNbsp(boolean replaceSpToNbsp)

    set method of replaceSpToNbsp

    Parameters:
    replaceSpToNbsp - Replace half-width space with &nbsp; conversion flag

    getReplaceLFtoBR

    public boolean getReplaceLFtoBR()

    get method of replaceLFtoBR

    Returns:
    replaceLFtoBR Replace linefeed code with <br> conversion flag

    setReplaceLFtoBR

    public void setReplaceLFtoBR(boolean replaceLFtoBR)

    set method of replaceLFtoBR

    Parameters:
    replaceLFtoBR - Replace linefeed code with <br> conversion flag

    getIgnore

    public boolean getIgnore()

    get method of ignore

    Returns:
    ignore ignore attribute value

    setIgnore

    public void setIgnore(boolean ignore)

    set method of ignore

    Parameters:
    ignore - ignore attribute value

    getName

    public java.lang.String getName()

    get method of name

    Returns:
    name

    setName

    public void setName(java.lang.String name)

    set method of name

    Parameters:
    name - name attribute value

    getProperty

    public java.lang.String getProperty()

    get method of property

    Returns:
    property

    setProperty

    public void setProperty(java.lang.String property)

    set method of property

    Parameters:
    property - property attribute value

    getScope

    public java.lang.String getScope()

    get method of scope

    Returns:
    scope

    setScope

    public void setScope(java.lang.String scope)

    set method of scope

    Parameters:
    scope - scope attribute value

    getFillColumn

    public int getFillColumn()

    get method of fillColumn

    Returns:
    fillColumn

    setFillColumn

    public void setFillColumn(int fillColumn)

    set method of fillColumn

    Parameters:
    fillColumn - fillColumn attribute value

    getAddBR

    public boolean getAddBR()

    get method of addBR

    Returns:
    addBR addBR attribute value

    setAddBR

    public void setAddBR(boolean addBR)

    set method of addBR

    Parameters:
    addBR - addBR attribute value

    doStartTag

    public int doStartTag()
                   throws javax.servlet.jsp.JspException

    Performs start tag processing.

    Specified by:
    doStartTag in interface javax.servlet.jsp.tagext.Tag
    Overrides:
    doStartTag in class javax.servlet.jsp.tagext.TagSupport
    Returns:
    int Process control instructions
    Throws:
    javax.servlet.jsp.JspException - When JSP exception occurs

    release

    public void release()

    Releases all allocated resources.

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