【发布时间】:2014-01-29 18:05:14
【问题描述】:
我正在使用 JSP 开发 Struts2 框架。我的 *.properties 文件中有:
hover_remove=Remove access to {0} at {1}`
我在我的 JSP 中有一个提交标签:
title="%{getText('hover_remove', new String[]{{appLabel}, {locationLabel}})}"
这可以在 Java 中工作,但我在 JSP 中收到以下错误:
/WEB-INF/pages/admin/cm/view.jsp(9,287)
JSPG0055E: Unable to create an xml attribute from name
在 JSP 中使用getText(String, List String[]) 有什么技巧吗?
【问题讨论】:
-
String?什么字符串?some_cool_package.String还是java.lang.String?提示:问题中有提示。 :) -
@AleksandrM 谢谢!它现在显示了价值。但是,它显示的不是“第二次删除对第一个的访问”,而是显示“在[第二个]删除对[第一个]的访问”。是否可以删除方括号?当我只用一个测试时:
"%{getText('hover_remove', {appLabel})}"它显示正确。
标签: jsp struts2 properties-file dynamic-variables