Link to home
Start Free TrialLog in
Avatar of tiger0516
tiger0516

asked on

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

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.

Thanks,
Avatar of tiger0516
tiger0516

ASKER

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

<bean:define id="test" name="book" type="org.lonetree.tc.core.Book" />
  <%
  Iterator<String> itr=test.getAuthors().iterator();
  while (itr.hasNext())
  {
        out.println(itr.next());
        out.println("<br>");
  }
        %>
What's the better way to do it by using just struts tags?
ASKER CERTIFIED SOLUTION
Avatar of boonleng
boonleng
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial