| Author |
Struts Simple question about collection
|
Nikhil Bansal
Ranch Hand
Joined: Jan 24, 2005
Posts: 60
|
|
Hi All, I'm trying to develop a simple application in Struts.Just to fetch the User Id from a table and present them to a JSP. While querying in DAO,I do set the id's in DTO as follows. userDTO.setUserId(rs.getString("USER_ID")); userIdList.add(userDTO); I'm able to get the ArrayList userIdList in Action class.From this Action class I've set the list userIdList in Form bean. I'm stuck as to how to retrieve the values from this list in JSP and show it accordingly. I mean the output in JSP should appear something like this User1 User2 User3 and so on. Any help shall be appreciated. Please bear,I'm new to struts. Regards Nikhil Bansal
|
ban$al
|
 |
Nikhil Bansal
Ranch Hand
Joined: Jan 24, 2005
Posts: 60
|
|
Hi K, I got the solution I did sth like this and it worked <table> <logic:iterate id="transactionList" property = "transactionIdList" name="userForm"> <tr> <td><a href="javascript:gotoTransaction(<bean:write name='transactionList' property='transactionId' /> "><bean:write name="transactionList" property="transactionId" /> </a> </td> </tr> </logic:iterate> </table> But now the problem is that it does not call the gotoTransaction function of javascript. i think that there is some problem with double quotes. Please if someone can help me with this. Regards Nikhil Bansal
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
Add single quotes to the parameter for your JavaScript function call. You're also missing a closing parenthesis. Here's corrected code. <a href="javascript:gotoTransaction('<bean:write name='transactionList' property='transactionId' />') "><bean:write name="transactionList" property="transactionId" /> </a> [ October 03, 2006: Message edited by: Merrill Higginson ]
|
Merrill
Consultant, Sima Solutions
|
 |
 |
|
|
subject: Struts Simple question about collection
|
|
|