从struts2中的属性文件在HTML中添加属性

从struts2中的属性文件在HTML中添加属性,struts2,Struts2,我的action类是从“com.opensymphony.xwork2.ActionSupport”扩展ActionSupport类。我想使用属性文件在JSP中添加一个html标记属性。下面是一个例子 <label> <s:text name="getText('abc.def.userID')" /> </label> <input name="useralias" id="useralias" autocomplete="off" type="te

我的action类是从“com.opensymphony.xwork2.ActionSupport”扩展ActionSupport类。我想使用属性文件在JSP中添加一个html标记属性。下面是一个例子

<label>
<s:text name="getText('abc.def.userID')" />
</label> 
<input name="useralias" id="useralias" autocomplete="off" type="text" class="textfield" maxlength="Value From PropertyFile"/>
这没有帮助

感谢您的建议。

使用解决方案

<s:set var="userIdLen"><%=getText('abc.def.userID.length')%></s:set>

然后,在maxLength属性中使用OGNL,如下所示

<s:textfield maxlength="%{#userIdLen}" key="useralias" autoComplete="off"/>     


我确信该字段在默认情况下不会被OGNLized;您可以尝试使用OGNL转义序列来强制执行。感谢@DaveNewton的建议。
<s:textfield maxlength="%{#userIdLen}" key="useralias" autoComplete="off"/>