-
Apr 12th, 2006, 11:55 PM
#1
spring:bind on a multi-select list
I have a wizard form controller and on one of the pages, it uses the following tags to select a single item off the list and bind it to one property.
<spring:bind path="teacher.type.id" >
<select name="<c:out value="${status.expression}" />" size="6">
<c:forEach var="teacherType" items="${teacherTypes}">
<option value="<c:out value="${teacherType.id}"/>" <c:if test='${status.value==teacherType.id}'>selected="s elected"</c:if> >
<c:out value="${teacherType.type}"/>
</option>
</c:forEach>
</select>
</spring:bind>
I need to modify this select to allow for multiple selection, what would be the bind type if there are multiple selection? Or is there are a way to bind?
If not, are there other ways to handle this?
Thanks.
-
Apr 13th, 2006, 01:49 AM
#2
I realized that there is a onBind() method that I can use. It does provide the HTTPServletRequest object, hence I can just do a getParameterValues() to retrieve the multi-selected items and manually bind the values to the command.
I was surprised that the values do stick from one page to another, I guess spring probably stores this in a session, hence "binding" the object.
If there are other better solutions than this, or if there are other things that I need to be aware of when using this approach, please let me know.
Thanks.
-
Apr 13th, 2006, 02:45 PM
#3
Found the following webpage ...
http://www.jroller.com/page/raible?e...ith_spring_mvc
which precisely describes what I'm looking for.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules