Struts2系列_#attr.xxxx
attr是struts2添加到值栈的上下文取的一个Map(org.apache.struts2.util.AttributeMap)
这个attr包含4个作用域:
A Map that holds 4 levels of scope.
The scopes are the ones known in the web world.:
Page scope
Request scope
Session scope
Application scope
Dispatcher.java struts2在执行action之前默认放到上下文的 ActionContext
Java代码
// helpers to get access to request/session/application scope
extraContext.put("request", requestMap);
extraContext.put("session", sessionMap);
extraContext.put("application", applicationMap);
extraContext.put("parameters", parameterMap);
AttributeMap attrMap = new AttributeMap(extraContext);
extraContext.put("attr", attrMap);
按照这个顺序查找属性,顺序是page—>request—–>session—->application;
也就是说通过ActionContext.getContext.get(“attr”) 是可以获取的到的。
attr 是通过ognl表达式,用于访问上下文数据的。