| Author |
logic:iterate & DTO Problem
|
Eibhlin Reid
Greenhorn
Joined: Nov 04, 2004
Posts: 28
|
|
|
Does anyone know if it is possible to use <bean:write tag on a collection of DTO objects, within a <logic:iterate tag?
|
 |
Horatio Westock
Ranch Hand
Joined: Feb 23, 2005
Posts: 221
|
|
Yes, you can use logic:iterator to iterate through the collection, then use bean:write to write out info from your DTOs: or
|
 |
Eibhlin Reid
Greenhorn
Joined: Nov 04, 2004
Posts: 28
|
|
Thanks for that, we are already using the first piece of code EXACTLY as you gave it: <logic resent name="topicsList"> <logic:iterate id="topic" name="topicsList" scope="request" > <bean:write name="topic" property="title"/> </logic:iterate><br> </logic resent> However we are recieveing the following error: org.apache.jasper.JasperException: Cannot find bean topic in any scope
|
 |
Marc Peabody
pie sneak
Sheriff
Joined: Feb 05, 2003
Posts: 4725
|
|
Your collection probably contains a null value. If so, you'll have to insert another logic:present for topic inside of the iterate tag. It wouldn't hurt to try out JSTL's c:forEach for your iterations. Once you try it, you probably won't go back to logic:iterate. Just a suggestion.
|
A good workman is known by his tools.
|
 |
Eibhlin Reid
Greenhorn
Joined: Nov 04, 2004
Posts: 28
|
|
|
Thanks for all your help, as it turned out we were missing a tag at the top of of the JSP!!
|
 |
 |
|
|
subject: logic:iterate & DTO Problem
|
|
|