Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Simple question about collection

 
Nikhil Bansal
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Nikhil Bansal
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic