Hi.. i have a problem about a nested model object which is a list containing a collection of a custom class..
I also tried to read this thread:
http://forum.springframework.org/showthread.php?t=9845
but in that thread the example show only if the nested object is a custom class.. not a list/collection of a custom class
I have a model object named: PendingWoCommand to be passed to jsp:
and the PendingWoList class is like this:Code:public class PendingWoCommand{ private List branchList; private List techList; private List solutionList; private List pendingWoList; // --> collection of a custom class named pendingWoList private List statusList; private String currentDate; private String cabang; private String stat; // ... getter & setter }
so far for populating the list object with a collection of PendingWoList and showing the contents in jsp is no problem..Code:public class PendingWoList { private String rcpt_no; private String status; private String promise_dt; private String model; private String address3; private String solution; private String technician; private String remarks; // ... getter & setter }
but what I want to ask is:
in the PendingWoList class, theres a string named solution and technician which I want to show as a combo box .. and when I submitted the form I want to bind each of their values to the objects contained in the list in PendingWoCommand...
my view in jsp is like this:
but i can't seem to find a way to bind each of the string in the combo box named solution and technician to each PendingWoList object contained in the list in PendingWoCommand.. is there a way to do this? using initBinder and custom editors? or I should do that manually in onSubmit? using getParameterValues?Code:<c:forEach var="wo" items="${pwc.pendingWoList}" varStatus="status"> <tr> <td></td> <td>${wo.rcpt_no}</td> <td>${wo.status}</td> <td>${wo.promise_dt}</td> <td>${wo.model}</td> <td>${wo.address3}</td> <td> <select name="solution" onmouseover="window.status='Solutions';" onmouseout="window.status='';"> <c:forEach var="sol" items="${pwc.solutionList}" varStatus="stat"> <option value="${sol.sol_cd}" <c:if test="${wo.solution eq sol.sol_cd}"> selected="true" </c:if> >${sol.sol_name}</option> </c:forEach> </select> </td> <td> <select name="technician" onmouseover="window.status='Technicians';" onmouseout="window.status='';"> <option value="-">-</option> <c:forEach var="tec" items="${pwc.techList}" varStatus="stat"> <option value="${tec.user_id}" <c:if test="${wo.technician eq tec.user_id}"> selected="true" </c:if> >${tec.user_nm}</option> </c:forEach> </select> </td> <td>${wo.remarks}</td> </tr> </c:forEach>
any help would be appreciated.. thanks..


Reply With Quote