use*_*271 5 jsp struts2 properties-file dynamic-variables
我正在使用JSP开发Struts2框架.我有*.properties文件:
hover_remove=Remove access to {0} at {1}`
Run Code Online (Sandbox Code Playgroud)
我在JSP中的提交标记中:
title="%{getText('hover_remove', new String[]{{appLabel}, {locationLabel}})}"
Run Code Online (Sandbox Code Playgroud)
这将在Java中工作,但我在JSP中遇到以下错误:
/WEB-INF/pages/admin/cm/view.jsp(9,287)
JSPG0055E: Unable to create an xml attribute from name
Run Code Online (Sandbox Code Playgroud)
getText(String, List String[])在JSP中
使用的任何提示?
如果要创建 String-s 数组,则需要对类使用 FQN 并删除不需要的大括号。
title="%{getText('hover_remove', new java.lang.String[]{appLabel, locationLabel})}"
Run Code Online (Sandbox Code Playgroud)
但您可以使用getText接受List第二个参数的方法并利用 OGNL 列表创建功能。在 OGNL 中,要创建列表,您需要简单地将表达式列表放在花括号中。
title="%{getText('hover_remove', {appLabel, locationLabel})}"
Run Code Online (Sandbox Code Playgroud)