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
- 多个组件的复杂布局 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 从 python 访问 JVM 2022-01-01
