freemarker.ext.jsp
Class JspContextModel
java.lang.Object
freemarker.ext.jsp.JspContextModel
- All Implemented Interfaces:
- TemplateHashModel, TemplateModel
public class JspContextModel
- extends java.lang.Object
- implements TemplateHashModel
A TemplateHashModel
that allows access to
JSP variables within a given scope. The scope corresponds to the scope
constants defined in javax.servlet.jsp.PageContext
.
- Version:
- $Id: JspContextModel.java 1115 2013-04-12 04:14:28Z run2000 $
Constructor Summary |
JspContextModel(javax.servlet.jsp.PageContext pageContext,
int scope)
Constructor for a JspContextModel. |
Method Summary |
TemplateModel |
get(java.lang.String key)
Retrieve the requested variable from a JSP page. |
boolean |
isEmpty()
Is the template model empty? |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ANY_SCOPE
public static final int ANY_SCOPE
- See Also:
- Constant Field Values
PAGE_SCOPE
public static final int PAGE_SCOPE
- See Also:
- Constant Field Values
REQUEST_SCOPE
public static final int REQUEST_SCOPE
- See Also:
- Constant Field Values
SESSION_SCOPE
public static final int SESSION_SCOPE
- See Also:
- Constant Field Values
APPLICATION_SCOPE
public static final int APPLICATION_SCOPE
- See Also:
- Constant Field Values
JspContextModel
public JspContextModel(javax.servlet.jsp.PageContext pageContext,
int scope)
- Constructor for a JspContextModel.
- Parameters:
pageContext
- the context in which JSP variables can be foundscope
- the scope of the variables we're interested in
get
public TemplateModel get(java.lang.String key)
throws TemplateModelException
- Retrieve the requested variable from a JSP page.
- Specified by:
get
in interface TemplateHashModel
- Parameters:
key
- the variable to be retrieved
- Returns:
- the variable wrapped in an appropriate
TemplateModel
- Throws:
TemplateModelException
- there was a problem getting the value
for the given key
isEmpty
public boolean isEmpty()
- Is the template model empty?
- Specified by:
isEmpty
in interface TemplateModel
- Returns:
false
, to indicate that the model is not empty