org.apache.struts2.views.freemarker
public class: ScopesHashModel [javadoc |
source]
java.lang.Object
freemarker.template.SimpleHash
org.apache.struts2.views.freemarker.ScopesHashModel
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
| Method from org.apache.struts2.views.freemarker.ScopesHashModel Summary: |
|---|
|
get, put, put |
| Method from org.apache.struts2.views.freemarker.ScopesHashModel Detail: |
public TemplateModel get(String key) throws TemplateModelException {
// 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(String string,
boolean b) {
super.put(string, b);
}
|
public void put(String string,
Object object) {
super.put(string, object);
}
|