SpringMVC: Is it possible to define more than one path on the form tag?
Hey, I'm pretty new in Spring MVC, and I'm learning the JSP tags and data. I have this Spring jsp where I want to fill a dropdown box with data from two different lists in the command object. The code looks like this:
<form:select path="SomeObject" id="someId">
SomeBean is a Collection on the Command object, so I do:
<c:foreach items="${SomeObject}" var="item">
<option value="${item.id}">${item.name}</option>
Then I should use a <c:choose>
tag, so that when the item reaches a certain Id, I should gather information from a different "SomeObj开发者_开发技巧ect" in the Command object, and put this info into the dropdown box.
Is this possible using the JSP tags? I guessed using one more path for the form, or creating a new form tag inside the select but this didn't seem to make much sense.
Another possibility is doing this using JS, the project has some motools code in it, so JavaScript would be a possibility.
You could build up some fairly complex logic in your view (.jsp), but you should probably build up your data model where it can be properly tested to meet your criteria. The right place for this is in your controller: merge your data sources and set up a single complete list to iterate over, and allow your view to be just a loop over that.
精彩评论