my dog learned polymorphism*
The moose likes Struts and the fly likes Write a property of a Javabean (DTO) in a jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Write a property of a Javabean (DTO) in a jsp" Watch "Write a property of a Javabean (DTO) in a jsp" New topic
Author

Write a property of a Javabean (DTO) in a jsp

Giulietta Blumarine
Ranch Hand

Joined: Dec 03, 2004
Posts: 59
I have the following code:

Collection c = (Collection) session.getAttribute("list");
Pagination dto = (Pagination)c.iterator().next();
<!--I need only the first DT-->
String userName= dto.getUserName();


and I want to write once with Struts the value of the property userName.
Why the code

<bean:write name="dto" property="userName">

doesn't work???

Thanks
Soumya Saha
Ranch Hand

Joined: Apr 14, 2006
Posts: 64
Hi Giulietta,
Add your collection to a ArrayList variable in the FormBean.Then use the following code in your JSP.It should work.
(Change your FormName/domain/app/applicably)
<logic:iterate id="abc" name="yourForm" property="paginationList" type="com.yourdomain.yourApp.dto.PaginationDTO">
<tr>
<td>
<bean:write name="abc" property="userName" />
</td>
</tr>

Thanks
Soumya
 
wood burning stoves
 
subject: Write a property of a Javabean (DTO) in a jsp
 
Similar Threads
how to do a pagination like "Page: 1 2 3 4 5 6 7" in a jsp ?
Pagination?
Pagination
pagination
how to do a Pagination like "Page:1 2 3 4 5 6 " in a jsp?