| Author |
logic:iterate -- urgent
|
Vineela Devi
Ranch Hand
Joined: Dec 20, 2003
Posts: 191
|
|
Hi All, I have an arraylist of Emp Ids and an arraylist of EmpNames.How can i concatentae both of them and display using logic iterate tag? i.e. Emp Name Empid John 001 Tom 002 I wnat to display the list in a jsp as John 001 Tom 002 etc. If not possible with logic:iterate any other solution is also ok Thanks in advance vineela
|
 |
Ankur Srivastava
Ranch Hand
Joined: May 11, 2004
Posts: 62
|
|
Create two tables inside a table this way <table> <td> <table> <!-- Use Iterate tag --> </table> </td> <td> <table> <!-- Use Iterate tag --> </table> </td> </table> I hope this approach will solve your problem.
|
 |
Nicholas Cheung
Ranch Hand
Joined: Nov 07, 2003
Posts: 4982
|
|
If you have 2 arrayLists, say empIds and empNames, you could put the 2 arrary lists into the request inside the DispatchAction: Then, inside your JSP, you can use <c:forEach> to loop out all data: I dont know how to use <logic:iterator> and thus, I can only provide a solution that with <c:forEach>. Hope this help. Nick [ May 20, 2004: Message edited by: Nicholas Cheung ]
|
SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
|
 |
Jagdeep Singh
Ranch Hand
Joined: Oct 14, 2002
Posts: 106
|
|
You need to build new ArrayList concatnating this two together and then use following code... <html:select property="empD" styleClass="blk9fntnor" > <logic:iterate id="empIds" name="EMPID_COLLECTION" type="com....vo.EmpeVo"> <bean efine id="tempValue" name="empIds" property="empID" type="java.lang.String"/> <bean efine id="tempLabel" name="empIds" property="empName" type="java.lang.String"/> <% String refSourceID = CUtil.convertNullToString(empID()); %> <%if(empID.equals(tempValue)){%> <option value="<%=tempValue%>" selected><%=tempLabel%></option> <%}else{%> <option value="<%=tempValue%>"><%=tempLabel%></option> <%}%> </logic:iterate> </html:select>
|
Jagdeep Singh<br />SCJP;SCWCD;IBM Certified XML Solution Developer;SCBCD1.3
|
 |
Marc Peabody
pie sneak
Sheriff
Joined: Feb 05, 2003
Posts: 4695
|
|
|
Sounds like a VERY good candidate for a Map instead of 2 Lists.
|
A good workman is known by his tools.
|
 |
Nicholas Cheung
Ranch Hand
Joined: Nov 07, 2003
Posts: 4982
|
|
In fact, the best way to deal with this case should be using of TransferObject, instead of using any Map or List. We can create a TransferObject (TO) for EmpInfo as follows: And the data are stored in the form of TO, and thus, when the data server returns a List or Collection of this type of TO, you store the list or collection into the request by: Then you can simply access it by: Thus, you even dont need to access the data via the Map, you can use an OO approach to access your data. Nick [ May 20, 2004: Message edited by: Nicholas Cheung ]
|
 |
 |
|
|
subject: logic:iterate -- urgent
|
|
|