根据标记文件中的TLD或属性指令,属性名称不接受任何表达式 [英] According to TLD or attribute directive in tag file, attribute name does not accept any expressions

查看:3454
本文介绍了根据标记文件中的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或属性指令,属性名称不接受任何表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆