jp.terasoluna.fw.web.struts.taglib
Class ChangeStyleClassTag

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

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

Implementation class of changeStyleClasstag.

Switches the class name of stylesheet depending on whether the error information of the specified field is set or not.
When there is a error in the field of action form, this class is used to change the display such as changing the part of that field to red.

Attribute supported by tag

In changeStyleClass tag, following attributes are supported.

Attribute name Default value Required Execution time format Overview
name - true true Field name that determines whether the error information is set.
default - true true Stylesheet class name when there is no error.
error - true true Stylesheet class name when there is error.


Scripting variable of custom tag.

There is no scripting variable set by this tag.


How to use

 <td class='<ts:changeStyleClass name="mou1"
    default="gaid" error="error"/>'>
   <input type="text" name="mou1">
 </td>
 

See Also:
Serialized Form

Field Summary
private  java.lang.String defaultValue
          Class name of stylesheet when there is no error in the field.
private  java.lang.String errorValue
          Class name of stylesheet when there is error in the field.
private static org.apache.commons.logging.Log log
          Log class.
private  java.lang.String name
          Field name that determines whether the error information is set.
private static long serialVersionUID
          Serail 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
ChangeStyleClassTag()
           
 
Method Summary
private  java.lang.String chooseClass(javax.servlet.http.HttpServletRequest req, java.lang.String fieldName, java.lang.String ifNormal, java.lang.String ifError)
          Returns the class name of stylesheet depending on whether the error information is set in the specified field.
 int doEndTag()
          Method which is called at the time of terminating tag evaluation.
 int doStartTag()
          Method which is called at the time of starting tag evaluation. Changes the stylesheet class name depending on the error.
 void release()
          Process at the time of releasing the tag handler.
 void setDefault(java.lang.String value)
          Sets the class name of stylesheet when there is no error in the field.
 void setError(java.lang.String value)
          Sets the class name of stylesheet when there is error in the field.
 void setName(java.lang.String name)
          Sets the field name.
 
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.


name

private java.lang.String name
Field name that determines whether the error information is set.


defaultValue

private java.lang.String defaultValue
Class name of stylesheet when there is no error in the field.


errorValue

private java.lang.String errorValue
Class name of stylesheet when there is error in the field.

Constructor Detail

ChangeStyleClassTag

public ChangeStyleClassTag()
Method Detail

setName

public void setName(java.lang.String name)
Sets field name.

Parameters:
name - Field name

setDefault

public void setDefault(java.lang.String value)
Sets class name of stylesheet when there is no error in the field.

Parameters:
value - Class name of stylesheet when there is no error.

setError

public void setError(java.lang.String value)
Sets the class name of stylesheet when there is error in the field.

Parameters:
value - Class name of stylesheet when there is a error.

chooseClass

private java.lang.String chooseClass(javax.servlet.http.HttpServletRequest req,
                                     java.lang.String fieldName,
                                     java.lang.String ifNormal,
                                     java.lang.String ifError)
Returns the class name of stylesheet depending on whether the error information is set in the specified field.

Parameters:
req - HTTP request
fieldName - Field name
ifNormal - Class name of stylesheet when there is no error
ifError - Class name of stylesheet when there is a error
Returns:
Class name of stylesheet

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Method which is called at the time of starting tag evaluation. Changes the stylesheet class name depending on the error.

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

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Method which is called at the time of terminating 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
Throws:
javax.servlet.jsp.JspException - JSP exception

release

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

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