It's not a secret anymore!
The moose likes Struts and the fly likes Struts Simple question about collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Simple question about collection" Watch "Struts Simple question about collection" New topic

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.


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


and so on.

Any help shall be appreciated.

Please bear,I'm new to struts.


Nikhil Bansal

Nikhil Bansal
Ranch Hand

Joined: Jan 24, 2005
Posts: 60

K, I got the solution

I did sth like this and it worked

<logic:iterate id="transactionList" property = "transactionIdList" name="userForm">
<td><a href="javascript:gotoTransaction(<bean:write name='transactionList' property='transactionId' /> "><bean:write name="transactionList" property="transactionId" />

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.


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" />
[ October 03, 2006: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
I agree. Here's the link:
subject: Struts Simple question about collection
It's not a secret anymore!