Reputation: 1091
HTML:
<select name="myList" id="myList" style="width: 170px;">
<option value="">All Items</option>
<c:forEach var="item" items="${items}">
<c:if test="${item != 'N/A'}">
<option value="${item}">${item}</option>
</c:if>
</c:forEach>
</select>
Controller:
...
List<Item> myItemList = itemDaoImpl.getAll();
...
view.addObject("items", myItemList);
That is just the related part of my controller. And it gives me "error[object Object]" javascript error when I load my page and internal server error on controller call. I do not understand the reason, could you please guide me ?
Upvotes: 0
Views: 141
Reputation: 2949
Have look at the sample of iteration,
<c:forEach var="item" items="${items}">
<c:if test="${item.itemName !='N/A'}">
<option value="${item.itemId}">${item.itemName}</option>
</c:if>
</c:forEach>
You must replace (itemName, itemId) it with your class member(s).
Cheers..!
Upvotes: 1