jp.terasoluna.fw.web.taglib
Class LeftTag

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

public class LeftTag
extends StringFormatterTagBase

Implementation class of lefttag that trims the characters of a string from the left side.

Trims the characters of a string from the left side by using the substring() method of StringUtil class.


Attribute supported by tag

Refer to StringFormatterTagBase.


Scripting variable of custom tag

Refer to StringFormatterTagBase.
Following are the scripting variables that have been added in this class.

Attribute name Default rtexprvalue Description
length - true Number of characters to be trimmed from the string.


How to use

To trim 5 characters from the left side of "field001" property value of "form0001" bean and output the value, see the following example.

  <t:left name="form0001"
             property="field001"
             length="5" />
 

To set the bean property to the scripting variable without outputting it to the custom tag, see the following example.

  <t:left id="cut"
             name="form0001"
             property="field001"
             length="5" />
 

To specify the string to be trimmed in the value attribute of custom tag without fetching that string from the bean, see the following example.

  <t:left value="String before trimming the specified characters"
             length="5" />
 

See Also:
StringFormatterTagBase, Serialized Form

Field Summary
protected  int length
          Length of the string to be trimmed.
private static long serialVersionUID
          Serial version ID
 
Fields inherited from class jp.terasoluna.fw.web.taglib.StringFormatterTagBase
filter, id, ignore, name, property, replaceSpToNbsp, scope, value
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
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
LeftTag()
           
 
Method Summary
protected  java.lang.String doFormat(java.lang.String s)
          From the left side of the string, fetches the number of characters specified in lenth attribute.
 int getLength()
          Fetches the length of string to be trimmed.
 void release()
          Releases all allocated resources.
 void setLength(int length)
          Sets the length of string to be trimmed.
 
Methods inherited from class jp.terasoluna.fw.web.taglib.StringFormatterTagBase
doStartTag, getFilter, getId, getIgnore, getName, getProperty, getReplaceSpToNbsp, getScope, getValue, setFilter, setId, setIgnore, setName, setProperty, setReplaceSpToNbsp, setScope, setValue
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, findAncestorWithClass, getParent, getValue, getValues, removeValue, 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

length

protected int length
Length of string to be trimmed.

Constructor Detail

LeftTag

public LeftTag()
Method Detail

getLength

public int getLength()
Fetches the length of string to be trimmed.

Returns:
Length of string to be trimmed

setLength

public void setLength(int length)
Sets the length of string to be trimmed.

Parameters:
length - Length of string to be trimmed

release

public void release()
Releases all allocated resources.

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

doFormat

protected java.lang.String doFormat(java.lang.String s)
From the left side of the string, fetches the number of characters specified in the lenth attribute.

Specified by:
doFormat in class StringFormatterTagBase
Parameters:
s - String to be formatted
Returns:
Trimmed string