org.appfuse.webapp.taglib
Class ConstantsTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.appfuse.webapp.taglib.ConstantsTag
All Implemented Interfaces:
Serializable, IterationTag, Tag

public class ConstantsTag
extends TagSupport

This class is designed to put all the public variables in a class to a specified scope - designed for exposing a Constants class to Tag Libraries.

It is designed to be used as follows:

<tag:constants />

Optional values are "className" (fully qualified) and "scope".

View Source

Version:
$Revision: 1.7 $ $Date: 2006-01-29 23:00:13 -0600 (Sun, 29 Jan 2006) $
Author:
Matt Raible
See Also:
Serialized Form
JSP Tag:
name="constants" bodycontent="empty" tei-class="org.appfuse.webapp.taglib.ConstantsTei"

Field Summary
 String clazz
          The class to expose the variables from.
protected  String scope
          The scope to be put the variable in.
protected  String var
          The single variable to expose.
 
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
ConstantsTag()
           
 
Method Summary
 int doStartTag()
           
 String getClassName()
           
 String getScope()
           
 int getScope(String scopeName)
          Converts the scope name into its corresponding PageContext constant value.
 String getVar()
           
 void release()
          Release all allocated resources.
 void setClassName(String clazz)
           
 void setScope(String scope)
           
 void setVar(String var)
           
 
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

clazz

public String clazz
The class to expose the variables from.


scope

protected String scope
The scope to be put the variable in.


var

protected String var
The single variable to expose.

Constructor Detail

ConstantsTag

public ConstantsTag()
Method Detail

doStartTag

public int doStartTag()
               throws JspException
Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class TagSupport
Throws:
JspException

setClassName

public void setClassName(String clazz)
JSP Attribute:

getClassName

public String getClassName()

setScope

public void setScope(String scope)
JSP Attribute:

getScope

public String getScope()

setVar

public void setVar(String var)
JSP Attribute:

getVar

public String getVar()

release

public void release()
Release all allocated resources.

Specified by:
release in interface Tag
Overrides:
release in class TagSupport

getScope

public int getScope(String scopeName)
             throws JspException
Converts the scope name into its corresponding PageContext constant value.

Parameters:
scopeName - Can be "page", "request", "session", or "application" in any case.
Returns:
The constant representing the scope (ie. PageContext.REQUEST_SCOPE).
Throws:
JspException - if the scopeName is not a valid name.


Copyright � 2002-2006