bean:write on a Collection (Set<String>)

Posted on 2007-11-27
Last Modified: 2013-11-24
In my Action, I have: request.setAttribute("book", book);

book is a Book object, which has a getAuthors method. getAuthors
returns a collection (Set<String>)

in JSP page, I want to list authors one by one. How shall I do?

<bean:write name="book" property="authors" /> does not work as I want.

Question by:tiger0516
  • 2

Author Comment

ID: 20357270
I barely made it work by using jsp and bean:define.

<bean:define id="test" name="book" type="" />
  Iterator<String> itr=test.getAuthors().iterator();
  while (itr.hasNext())

Author Comment

ID: 20357272
What's the better way to do it by using just struts tags?
LVL 14

Accepted Solution

boonleng earned 50 total points
ID: 20358772

<logic:iterate id="test" name="book" property="authors">

    <bean:write name="test/>


Open in new window


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Connect to IP Camera using Java 4 162
countHi2 challenge 7 52
wordmultiple challenge 12 118
ForLoop Example 3 40
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now