3

在我的 Jsp 中,我有单选按钮

typeA

typeB

typeC

typeD 

我使用了以下标签:

<c:forEach var="abcTyp" items="${abcTypeList}">
    <form:radiobutton path="abcType" value="<spring:message code="label.admin.lot.${abcType.value}" />" label="${abcTyp.value}" onclick="actSingStone();"/>
</c:forEach>

但我不想使用“abcTyp.value”作为标签,而是想使用国际化消息表单资源包。

我尝试使用

<form:radiobuttons path="abcType" value="${abcTypeList}" label="<spring:message code="label.admin.pep.${abcTyp.value}"/>." onclick="actSingStone();"/>

在我提到的资源文件中

label.admin.pep.typeA = some text
label.admin.pep.typeB = some text
label.admin.pep.typeC = some text
label.admin.pep.typeD = some text

但它给出了一个错误“预期的等号”

任何人都可以给我同样的解决方案....??

4

1 回答 1

2

尝试将标签设置为变量并使用它,如下所示

<c:forEach var="abcTyp" items="${abcTypeList}">
  <c:set var="labelVar">
      <spring:message code="label.admin.lot.${abcType.value}" />
  </c:set>    
  <form:radiobutton path="abcType" label="${labelVar}" value="${abcTyp.value}" onclick="actSingStone();"/>    
</c:forEach>
于 2012-08-03T09:21:33.193 回答