org.chwf.taglib.jutil
Class ParamTag
java.lang.Object
|
+--javax.servlet.jsp.tagext.TagSupport
|
+--javax.servlet.jsp.tagext.BodyTagSupport
|
+--org.chwf.taglib.base.LifeCycleBodyTagSupport
|
+--org.chwf.taglib.jutil.ParamTag
- All Implemented Interfaces:
- javax.servlet.jsp.tagext.BodyTag, Parameterized, java.io.Serializable, javax.servlet.jsp.tagext.Tag
- Direct Known Subclasses:
- AttributeTag
- public class ParamTag
- extends LifeCycleBodyTagSupport
Tag handler for the <param>
tag. It has one attribute,
"name", which is the name of the generated parameter. This handler
sets the parameter or attribute value in one of two ways:
- If the trimmed tag body is not an empty string, it sets the
value equal to the processed contents of the tag body.
- Otherwise, it sets the parameter value to the first matching web
application variable, searching first request parameters, then
web application scopes in order (page to application).
Once the parameter is set, the handler retrieves its parent tag. If the
parent tag implements the Parameterized
interface, it
calls the tags addParameter()
method. If not, it throws a
JspException
.
- Author:
- Paul Strack
- See Also:
- Serialized Form
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
bodyContent |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
id, pageContext |
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag |
EVAL_BODY_TAG |
Fields inherited from interface javax.servlet.jsp.tagext.Tag |
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Method Summary |
void |
cleanup()
Clean up data for tag handler reuse and pooling. |
int |
doEnd()
Set parameter value from tag body or scoped variable. |
java.lang.Object |
findObject()
Find the object for the tag or the default object if no object was
specified. |
java.lang.String |
getName()
The parameter name. |
java.lang.String |
getObject()
Get object name used to lookup the object. |
protected Parameterized |
getParametrizedTag()
Derived parametrized tag to be updated. |
java.lang.String |
getProperty()
The object property being retrieved. |
void |
setName(java.lang.String name)
The parameter name. |
void |
setObject(java.lang.String objectName)
The object name. |
void |
setProperty(java.lang.String property)
The object property being retrieved. |
Methods inherited from class org.chwf.taglib.base.LifeCycleBodyTagSupport |
addAttribute, addParameter, doEndTag, doStart, doStartTag, getAttribute, getAttributeNames, getParameter, getParameterNames, init, printAttributes |
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
doAfterBody, doInitBody, getBodyContent, getPreviousOut, release, setBodyContent |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
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 |
Methods inherited from interface javax.servlet.jsp.tagext.Tag |
getParent, setPageContext, setParent |
ParamTag
public ParamTag()
cleanup
public void cleanup()
- Clean up data for tag handler reuse and pooling. Should be overridden in
tag handler. Subclasses should always invoke their superclass's cleanup
method:
super.cleanup()
- Overrides:
cleanup
in class LifeCycleBodyTagSupport
setName
public void setName(java.lang.String name)
- The parameter name.
- Parameters:
name
- The parameter name.
getName
public java.lang.String getName()
- The parameter name.
- Returns:
- The parameter name.
setProperty
public void setProperty(java.lang.String property)
throws javax.servlet.jsp.JspException
- The object property being retrieved. Defaults to var if absent.
- Parameters:
property
- The property name.- Throws:
javax.servlet.jsp.JspException
- If the property cannot be initialized.
getProperty
public java.lang.String getProperty()
- The object property being retrieved. Defaults to var if absent.
- Returns:
- The property name.
setObject
public void setObject(java.lang.String objectName)
throws javax.servlet.jsp.JspException
- The object name. Always optional. The tag will use the default object if
no object can is specified.
- Parameters:
objectName
- The object's name for lookup.- Throws:
javax.servlet.jsp.JspException
- If the object filter cannot be found.
getObject
public java.lang.String getObject()
- Get object name used to lookup the object.
- Returns:
- The object name.
findObject
public java.lang.Object findObject()
- Find the object for the tag or the default object if no object was
specified.
- Returns:
- The object.
doEnd
public int doEnd()
throws javax.servlet.jsp.JspException
- Set parameter value from tag body or scoped variable.
- Overrides:
doEnd
in class LifeCycleBodyTagSupport
- Returns:
- SKIP_BODY
- Throws:
javax.servlet.jsp.JspException
- If not nested in a parametrized tag.
getParametrizedTag
protected Parameterized getParametrizedTag()
- Derived parametrized tag to be updated.
- Returns:
- The parametrized tag.
Copyright © 2002-2004, Paul Strack. All Rights Reserved.