Refer the id variable of logic - iterate using jstl-el

1.8k Views Asked by At

Facing a unusual challenge :

//Code

<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>

How do i refer a field inside a list and pass it as an argument to onChangeStatus

1

There are 1 best solutions below

0
On

First, it seems you are missing an end tag for <logic:iterate> in your example code.

Second, unless you have a very good reason, try to use JSTL instead of the outdated struts custom tags. It's always good to stay with standards, right?

In your case, that would look like this:

<c:forEach items="${accountRouteConfigListForm.valueList}" var="list">
    ....
</c:forEach>