一般的,在JSP页面中访问Servlet/JSP作用域对象,可以使用Java脚本或EL表达式,在Struts2中,还可以使用OGNL表达式访问包括Application scope attributes, Session scope attributes, Request scope attributes, Request parameters and framework Context scope parameters:
Application Scope Attribute
- <s:property value="%{#application.myApplicationAttribute}" />
Session Scope Attribute
- <s:property value="%{#session.mySessionAttribute}" />
Request Scope Attribute
- <s:property value="%{#request.myRequestAttribute}" />
Request Parameter
- <s:property value="%{#parameters.myParameter}" />
Context Scope Parameter
- <s:property value="%{#myContextParam}" />
最后一个没有对应的EL访问方式,上面每个语句中去掉百分号和大括号也是可以的。