• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Struts Simple question about collection

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic