I have the below code in a
jsp page -- what I am trying to do is very common in that based on what a user previous selected in a menu(select) widget I need to then show that selected value in the menu again if the user submits the page and then is returned to the same page if there is an error condition(save the state) - my problem is I do not know how to achieve this as essentially I think I need to nest user.id within the test"${} condition - the below code does not work as user.id is not evaluating correctly? I am sure you must be able to do this somehow in jstl - I am just not familiar enough with jstl syntax -- I am using <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> tablib.
<select name="objectName" id="objectId>
<c:forEach var="user"items="${users}">
<option value="${user.id}"
<c:if test="${formBean.userId == user.id }">selected</c:if> > ${user.name}
</option>
</c:forEach>
</select>
Thanks very much