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 或属性指令,属性名称不接受任何表达式


基础教程推荐
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- 降序排序:Java Map 2022-01-01