谁能告诉我如何在 STRUTS2 OGNL 中使用“%”和“#”符号?我用谷歌搜索,但找不到任何有价值的信息。或者给我一个文档链接。
谢谢
The %
character forces OGNL evaluation, so <s:property name="%{foo}"/>
will query the stack for a foo
property. It's not always required (rarely, in fact), but it's easier to use it consistently for clarity.
The #
character accesses a named value stack context variable, for example, you used to need it to access a variable created using the <s:set>
tag. You need it to access things like a session variable, like <s:property name="#session.user.name"/>
.