com.gisgraphy.webapp.taglib
Class ConstantsTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by com.gisgraphy.webapp.taglib.ConstantsTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class ConstantsTag
extends javax.servlet.jsp.tagext.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

Author:
Matt Raible
See Also:
Serialized Form

Field Summary
protected  java.lang.String scope
          The scope to be put the variable in.
protected  java.lang.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()
          Main method that does processing and exposes Constants in specified scope
 java.lang.String getClassName()
           
 java.lang.String getScope()
           
 int getScope(java.lang.String scopeName)
          Converts the scope name into its corresponding PageContext constant value.
 java.lang.String getVar()
           
 void release()
          Release all allocated resources.
 void setClassName(java.lang.String clazz)
           
 void setScope(java.lang.String scope)
           
 void setVar(java.lang.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

scope

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


var

protected java.lang.String var
The single variable to expose.

Constructor Detail

ConstantsTag

public ConstantsTag()
Method Detail

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Main method that does processing and exposes Constants in specified scope

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.TagSupport
Returns:
int
Throws:
javax.servlet.jsp.JspException - if processing fails

setClassName

public void setClassName(java.lang.String clazz)

getClassName

public java.lang.String getClassName()

setScope

public void setScope(java.lang.String scope)

getScope

public java.lang.String getScope()

setVar

public void setVar(java.lang.String var)

getVar

public java.lang.String getVar()

release

public void release()
Release all allocated resources.

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

getScope

public int getScope(java.lang.String scopeName)
             throws javax.servlet.jsp.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:
javax.servlet.jsp.JspException - if the scopeName is not a valid name.


Copyright © 2010. All Rights Reserved.