【发布时间】:2011-09-12 13:00:18
【问题描述】:
当您使用<struts:text name="..."/> Struts 2 Text jsp 标记时,您会从页面中的 .properties 文件中获取文本。
例如,如果 .properties 文件包含
foo.bar = This is the text.
jsp标签<struts:text name="foo.bar"/>会输出
This is the text.
现在我希望 webapp 中的所有 <struts:text name="..."> 实例也可以在 HTML 注释中输出 name 属性,如下所示:
<!-- foo.bar -->This is the text.
我尝试创建自己的 jsp 标记文件(用来代替 <struts:text>),其中包含
<%@attribute name="name" required="true"%>
<!-- ${name} --><struts:text name="${name}"/>
但它不起作用,因为 struts:text 标记的 name 属性的 <rtexprvalue> 设置为 false。
有什么想法可以实现吗?
【问题讨论】:
-
foo.bar = <!-- foo.bar -->This is the text.? -
@Ischin:
foo.bar只是一个例子。我希望它对 .properties 文件中的所有数百个文本都一样。
标签: java templates text struts2 jsp-tags