|
From: Rodney G. A. \(Krosslink\) <ro...@kr...> - 2004-03-24 15:04:55
|
Hi, I have some problem in the MVC's binding process, when a class have =
two properties of the same type, eg:
class Wheel {
private Long id;
private String name;
=20
}
class Car {
private Wheel wheel1;
private Wheel wheel2;=20
}
This two classes with his sets and gets appropiates methods, and a jsp =
to drive this properties like that excerpt:
<tr>
<td>Wheel 1:</td>
<spring:bind path=3D"obj.wheel1.id">
<td>
<select name=3D"<c:out value=3D"${status.expression}"/>">
<c:forEach var=3D"wheel" items=3D"${wheels}">
<c:if test=3D"${obj.wheel1.id =3D=3D wheel.id}">
<OPTION selected=3D"<c:out =
value=3D"${obj.wheel1.id}"/>" value=3D"<c:out =
value=3D"${wheel.id}"/>"><c:out value=3D"${wheel.name}"/></OPTION>
</c:if>
<c:if test=3D"${obj.wheel1.id !=3D wheel.id}">
<OPTION value=3D"<c:out value=3D"${wheel.id}"/>"><c:out =
value=3D"${wheel.name}"/></OPTION>
</c:if>
</c:forEach>
</select>
</td>
</spring:bind>
</tr>
<tr>
<td>Wheel 2:</td>
<spring:bind path=3D"obj.wheel2.id">
<td>
<select name=3D"<c:out value=3D"${status.expression}"/>">
<c:forEach var=3D"wheel" items=3D"${wheels}">
<c:if test=3D"${obj.wheel2.id =3D=3D wheel.id}">
<OPTION selected=3D"<c:out =
value=3D"${obj.wheel2.id}"/>" value=3D"<c:out =
value=3D"${wheel.id}"/>"><c:out value=3D"${wheel.name}"/></OPTION>
</c:if>
<c:if test=3D"${obj.wheel2.id !=3D wheel.id}">
<OPTION value=3D"<c:out value=3D"${wheel.id}"/>"><c:out =
value=3D"${wheel.name}"/></OPTION>
</c:if>
</c:forEach>
</select>
</td>
</spring:bind>
</tr>
When a submit happens and Spring is going to update the values captured =
to the Bean, the two properties of the same type take the value of the =
first properties that is procesed in the bind algorithm, when the =
process finish the two properties get the same value, any help will be =
preciate. I already debugged some of the Spring code, and perhaps the =
problems is in the class "BeanWrapperImpl" method "setPropertyValue" =
when working with nested properties.
Best Regards, Rodney
Spring is really a powerfull framework, very good job, I already =
studying your samples and read documentation.
|