According to TLD or attribute directive in tag file, attribute name does not accept any expressions(根据标记文件中的 TLD 或属性指令,属性名称不接受任何表达式)
问题描述
我在 JSP 中编写了以下代码.
I write the following code in JSP.
<%
String p_loginPassword = OpeCommon.LOGIN_PASSWORD;
String p_encryptCode = OpeCommon.encriptPassword(OpeCommon.KEY_USER_ID, OpeCommon.KEY_USER_PASSCODE);
%>
<s:url id="printURL" action="actMod" method="printout">
<s:param name="<%=OpeCommon.LOGIN_PASSWORD %>"><%=OpeCommon.encriptPassword(OpeCommon.KEY_USER_ID, OpeCommon.KEY_USER_PASSCODE)%></s:param>
</s:url>
显示错误:根据标签文件中的 TLD 或属性指令,属性名称不接受任何表达式
It displays error : According to TLD or attribute directive in tag file, attribute name does not accept any expressions
我该怎么写,请给我一些建议.
How should I write for that, pls give me some suggestions.
推荐答案
不要在struts标签中使用scriptlet,不要在JSP中使用,如果不行你可以试试
Don't use scriptlets in the struts tags, don't use it at all in JSP, if you can't you may try
<s:set var="loginPassword"><%=OpeCommon.LOGIN_PASSWORD %></s:set>
<s:param name="%{#loginPassword}"><%=OpeCommon.encriptPassword(OpeCommon.KEY_USER_ID, OpeCommon.KEY_USER_PASSCODE)%></s:param>
请注意,可以通过 OGNL 表达式访问常量,并且该表达式在 struts 标记中是允许的.但是,它适用于 OGNL 语法,您应该为静态内容提供 FQCN.常量不需要在配置中启用静态访问,但需要调用静态方法.如果您允许静态访问,那么一切都可以通过 OGNL 表达式完成,如果不仅可以访问常量,例如
Note, that constants could be accessed through the OGNL expression, and that expression is allowed in the struts tags. But, it applies to the OGNL syntax and you should supply FQCN to the static content. Constants don't require enabling static access in the configuration, but calling a static method is required. If you allow static access then everything could be done via OGNL expressions, if not only constants could be accessed like
<s:param name="%{@com.package.OpeCommon@LOGIN_PASSWORD}">
这篇关于根据标记文件中的 TLD 或属性指令,属性名称不接受任何表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:根据标记文件中的 TLD 或属性指令,属性名称不接受任何表达式


- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01