Struts 2 quot;%quot; sign and #39;#quot; sign in OGNL(Struts 2“%签名和“#登录 OGNL)
问题描述
谁能告诉我如何在 STRUTS2 OGNL 中使用%"和#"符号?我用谷歌搜索,但找不到任何有价值的信息.或者给我一个文档链接.
Anybody can tell me how to use "%" and "#" sign in STRUTS2 OGNL? I google around, but can't find any valuable info about this.Or give me a link of documentation of this.
谢谢
推荐答案
% 字符强制 OGNL 评估,所以 <s:property name="%{foo}"/> 将在堆栈中查询 foo 属性.它并不总是必需的(实际上很少),但为了清晰起见,它更容易始终如一地使用.
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.
# 字符访问 named 值堆栈上下文变量,例如,您曾经需要它来访问使用 <s 创建的变量:设置>标签.您需要它来访问诸如会话变量之类的东西,例如 <s:property name="#session.user.name"/>.
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"/>.
- S2 OGNL 文档
- 特定于 S2 的 OGNL 文档
- OGNL 参考文档
这篇关于Struts 2“%"签名和“#"登录 OGNL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Struts 2“%"签名和“#"登录 OGNL
基础教程推荐
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
