我正在将代码从 Struts1 迁移到 Struts2
Struts1代码
<input type="text" value="<c:out value="${serviceVO.notifList}"/>" name="ServicesNotifList-<c:out value="${serviceVO.globalId}"/>#<c:out value="${serviceVO.id}"/>" size="50" maxlength="1000"/>
在 Struts2 中
我尝试过,但没成功
<c:set var="notifListTemp" value="ServicesNotifList-"></c:set>
<c:set var="notifListTemp1" >${notifListTemp}${serviceVO.globalId}</c:set>
<c:set var="notifListTemp2" value="#"></c:set>
<c:set var="notifListTemp3" >${notifListTemp1}${notifListTemp2}${serviceVO.id}</c:set>
<s:textfield theme="simple" value="${serviceVO.notifList}" name="${notifListTemp3}"
size="50" maxlength="1000" />
其中 serviceVO
是 display:table
id。
最佳答案
您不能在 Struts 标记的属性中使用 JSP EL 表达式,但很高兴您可以使用 OGNL 表达式。不在值堆栈中的对象可通过#attr
访问。
<s:textfield theme="simple" value="%{#attr.serviceVO.notifList}" name="%{#attr.notifListTemp3}"
size="50" maxlength="1000" />
关于jsp - 在 Struts 2 中动态生成名称和值属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41573453/