I am sending an ArrayList to this jsp file and reading it with this code:
<form:select path="student.ec[0].estate">
<form:option value="NONE" label="--- Select one ---" />
<form:options items="${estate}" />
</form:select>
Because I have path attribute in the above html, it stores the selected value in an appropriate bean. And I can also easily print it. But I want the above code to be converted to JSTL code. I want to be able to write the above code with c:ForEach tags. So far, I have only been able to show the dropdown menu. But it doesn't save the value selected in its appropriate bean. This is the code I got:
<select>
<c:forEach var="line" items="${availableLines}">
<option><c:out value="${line}"/></option>
</c:forEach>
</select>
I will appreciate any help. Thanks
Solution! Found it. Here is the code:
<form:select path="state" id="state">
<form:option value="NONE">Select State: </form:option>
<c:forEach items="${estateList}" var="stateslist">
<form:option value="${stateslist}">${stateslist}</form:option>
</c:forEach> </form:select>