aspose file tools*
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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Write a property of a Javabean (DTO) in a jsp