0

我想将字符串变量传递给 struts 标记。

alert('<bean:message key="${result}"/>');

此标签负责从 ApplicationResources.properties 中提取消息。结果包含此消息的密钥。系统尝试使用相同的结果字符串本身而不是其内容。这是我得到的错误。

“缺少密钥“${result}”的消息

我看到了这个问题,我有了一个想法,但问题仍然存在。 Struts 自定义标签中属性中的变量

我的应用程序基于struts。

我用这样的东西,但我觉得它又丑又臭

    if(result == 'a.b.c' )
        alert('<bean:message key="a.b.c"/>');
    else if(result == 'a.b.c' )
        alert('<bean:message key="a.b.d"/>');
    else if(result == 'a.b.d' )
        alert('<bean:message key="a.b.d"/>');
4

1 回答 1

0

请尝试以下操作:

alert('<bean:message name="result"/>');

http://struts.apache.org/1.2.x/userGuide/struts-bean.html#message

于 2012-05-21T12:01:44.533 回答