
Originally Posted by
Marten Deinum
First you put them in with the name 'obj' and you seem to add them both with the same name so the second overrides the first that isn't going to work...
Also you are adding things to the ModelAndView but are you also returning that from your controller method? Next to that make sure EL is enabled (use a correct version for the web.xml else it isn't enabled by default).
And please next time use [ code][/code ] tags when posting that way it remains readable....
In the JSP, one of the Map objects for the domain "Users" is correctly displaying user information back from the Controller, so EL is enabled.
Then, in the actual MAV, I'm adding the object like this:
Code:
mav.addObject("obj", userList);
mav.addObject("depts", someOtherList);
But, in the JSP, I cannot seem to access the "depts" in a select statement like this:
Code:
<select>
<c:forEach var="usr" items="${depts}" >
<option value="<c:out value="${usr.departmentName}"/>">
<c:out value="${usr.departmentName}" /></option>
</c:forEach>
</select>
The "depts" is a Set of Department objects which is different from the domain object Users that the Controller code is running in.
I'm not sure if this is part of the problem -- that you (maybe?) need to have a field in the domain object for anything put into the MAV maps objects.
Hope this clarifies my initial posting.
Look forward to your follow up.
Thanks
L