1

面临不寻常的挑战:

//代码

<logic:iterate id="list" name="accountRouteConfigListForm"  property="valueList" indexId="incr">
<div <custom:align defaultAlign="left"/>>
<html:select  name="list" property="accountStatus" onchange="onChangeStatus(${list.accName})"> //This is not working, how to refer accName in list
<html:option value="<%= String.valueOf(Constants.ENABLED) %>">
</html:option>
<html:option value="<%= String.valueOf(Constants.DISABLED) %>">
</html:option>

我如何引用列表中的字段并将其作为参数传递给onChangeStatus

4

1 回答 1

2

<logic:iterate>首先,您的示例代码中似乎缺少结束标记。

其次,除非你有很好的理由,否则尽量使用 JSTL 代替过时的 struts 自定义标签。遵守标准总是好的,对吧?

在你的情况下,这看起来像这样:

<c:forEach items="${accountRouteConfigListForm.valueList}" var="list">
    ....
</c:forEach>
于 2013-11-26T10:33:16.823 回答