ScopesHashModelpublic class ScopesHashModel extends freemarker.template.SimpleHash Simple Hash model that also searches other scopes.
If the key doesn't exist in this hash, this template model tries to
resolve the key within the attributes of the following scopes,
in the order stated: Request, Session, Servlet Context |
Fields Summary |
---|
private static final long | serialVersionUID | private HttpServletRequest | request | private ServletContext | servletContext | private com.opensymphony.xwork2.util.ValueStack | stack |
Methods Summary |
---|
public freemarker.template.TemplateModel | get(java.lang.String key)
// Lookup in default scope
TemplateModel model = super.get(key);
if (model != null) {
return model;
}
if (stack != null) {
Object obj = stack.findValue(key);
if (obj != null) {
return wrap(obj);
}
// ok, then try the context
obj = stack.getContext().get(key);
if (obj != null) {
return wrap(obj);
}
}
if (request != null) {
// Lookup in request scope
Object obj = request.getAttribute(key);
if (obj != null) {
return wrap(obj);
}
// Lookup in session scope
HttpSession session = request.getSession(false);
if (session != null) {
obj = session.getAttribute(key);
if (obj != null) {
return wrap(obj);
}
}
}
if (servletContext != null) {
// Lookup in application scope
Object obj = servletContext.getAttribute(key);
if (obj != null) {
return wrap(obj);
}
}
return null;
| public void | put(java.lang.String string, boolean b)
super.put(string, b);
| public void | put(java.lang.String string, java.lang.Object object)
super.put(string, object);
|
|