Spring MVC 3.2.8 Application Not Binding Select Object With Form
I have an application based on Spring Web model-view-controller (MVC) framework. Using this approach in JSP, the value in the associated
<form:select path="deviceKey" id="deviceSelectId" onchange="javascript:newWindowLocationAssignDevice(this.value);" >
<form:option value="all" label="ALL"/>
<form:options items="${allDeviceList}" itemValue="name" />
</form:select>
But using this approach, I always see the first option as selected regardless of the value of the form
<form:select path="deviceKey" id="deviceSelectId" onchange="javascript:newWindowLocationAssignDevice(this.value);" >
<form:option value="all" label="ALL"/>
<c:forEach items="${allDeviceList}" var="deviceVar">
<c:choose>
<c:when test="${!(deviceVar.name eq 'AWARDED') && !(deviceVar.name eq 'DRAFT') && !(deviceVar.name eq 'CANCELLED') && !(deviceVar.name eq 'IN_PROGRESS') && !(deviceVar.name eq 'REFUSED')}" >
<option value="${deviceVar.name}" > <fmt:message key="${deviceVar.key}" /></option>
</c:when>
<c:otherwise>
<option value="${deviceVar.name}"><fmt:message key="${deviceVar.key}" /></option>
</c:otherwise>
</c:choose>
</c:forEach>
</form:select>
+3
source to share
No one has answered this question yet
Check out similar questions: