• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Giulietta Blumarine
Ranch Hand
Posts: 59
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic