com.taggercat.tags
Class TCIfTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by com.taggercat.tags.AbstractExpEvalTag
          extended by com.taggercat.tags.TCIfTag
All Implemented Interfaces:
com.taggercat.el.ELPropertyResolver, java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag
Direct Known Subclasses:
TCIfThenElseTag

public class TCIfTag
extends AbstractExpEvalTag

This tag evaluates an expression and includes the body of the tag if the expression evaluates to true.

This tag functions the same as the JSTL tag of the same name. The difference is that it uses the Tagger Cat EL.

The test attribute is not wrapped in ${ and } delimiters.

If a var and scope attribute are set, then the result is also added as an attribute to that scope object. The scope variable is set even if the expression evaluates to false.

Tag Attributes

  1. test the expression to be evaluated
  2. var (optional) the variable name
  3. scope (optional) the scope to place the results on. The scope can be one of:
 page - default if not specified
 session
 request
 application
 


See Also:
Serialized Form
 

Field Summary
 
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
TCIfTag()
           
 
Method Summary
 int doEndTag()
          Process the end tag.
 int doStartTag()
          Process the start tag for this instance.
 boolean isConditionTrue()
          Returns the result of the expression.
 void setFormat(java.lang.String format)
          Sets the format for displaying the results.
 void setTest(java.lang.String test)
          Sets the expression string.
 
Methods inherited from class com.taggercat.tags.AbstractExpEvalTag
getModel, resolveProperty, setScope, setValue, setVar
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TCIfTag

public TCIfTag()
Method Detail

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Process the end tag. This method will be called on all Tag objects. All instance state associated with this instance must be reset.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class AbstractExpEvalTag
Throws:
javax.servlet.jsp.JspException
Returns:
EVAL_BODY_INCLUDE if the tag wants to process

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Process the start tag for this instance. The doStartTag() method assumes that all setter methods have been invoked before. When this method is invoked, the body has not yet been invoked.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class AbstractExpEvalTag
Throws:
javax.servlet.jsp.JspTagException
javax.servlet.jsp.JspException
Returns:
EVAL_BODY_INCLUDE if the tag wants to process body, SKIP_BODY if it does not want to process it.

isConditionTrue

public boolean isConditionTrue()
Returns the result of the expression.

Returns:
the boolean result of the expression

setFormat

public void setFormat(java.lang.String format)
Sets the format for displaying the results.

Parameters:
format - the format string value

setTest

public void setTest(java.lang.String test)
Sets the expression string.

Parameters:
test - the expression string