The application, session and request objects are available from within s
tags in jsp wherever ognl can be evaluated. Use the #application,
#session, or #request syntax to get the object and access values by
their keys using ['key'].
任何ognl能被计算的值,在jsp中用s标签都可以获得application,session和request对象。
<s:property value="#application\['foo'\]"/>
<s:property value="#session\['baz'\]"/>
Conversely, if you would like to make Struts 2 objects available to a JSP/JSTL scope, the s:set tag may be used like this:
相反,如果你项是的Struts2对象能在JSP/JSTL范围内获得,s:set标签可能这样用:
<s:set name="jobz" value="jobs" scope="request" />
<c:forEach items="${jobz} var="job">
...
</c:forEach>
|
"Auto-exposure"
In Struts 2 OGNL values are automagically exposed to JSP/JSTL; using <s:set.../> as described above may not be necessary.
在Struts2 OGNL的值被自动暴露给JSP/JSTL;上面例子中<s:set .../>可能不需要。
|
疑问啊:Struts2 OGNL和OGNL难道是两回事?