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".
Modifier and Type | Field and Description |
---|---|
protected String |
scope
The scope to be put the variable in.
|
protected String |
var
The single variable to expose.
|
Constructor and Description |
---|
ConstantsTag() |
Modifier and Type | Method and Description |
---|---|
int |
doStartTag()
Main method that does processing and exposes Constants in specified scope
|
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) |
protected String scope
protected String var
public int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.JspException
- if processing failspublic void setClassName(String clazz)
public String getClassName()
public void setScope(String scope)
public String getScope()
public void setVar(String var)
public String getVar()
public void release()
release
in interface javax.servlet.jsp.tagext.Tag
release
in class javax.servlet.jsp.tagext.TagSupport
public int getScope(String scopeName) throws javax.servlet.jsp.JspException
scopeName
- Can be "page", "request", "session", or "application" in
any case.javax.servlet.jsp.JspException
- if the scopeName is not a valid name.Copyright © 2015. All rights reserved.