File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Datagrid in Struts 2

 
rahulJ james
Ranch Hand
Posts: 123
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am developing a web application using struts 2 framework and with apache-tomcat 5.x..

I would like to know how to use datagrid in jsp using struts 2 or Is there any alternate way to display the dynamic datas from a database in a table represntation
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

If you want to display date into jsp page first define one list and through query get result and set into list variable.

with this variable list just iterate list variable. For Example.

for list define

private List<user> user= userDelegator.getuser();

this is with Struts2 + hibernate getuser gives user list then iterate like.

getUser mathod call

{
List<user> userlist = session.createCriteria(User.class).list();
return userlist;
}

<s:iterator value="user">
<tr>
<td>
<s:text name="userName" />
</td>
<td>
<s:text name="userEmail" />
</td>
<td>
<s:a href="edituser.action?id=%{id}">Edit</s:a>
</td>
</tr>
</s:iterator>

here userName and userEmail is Hibernate DTO name which gives you to value of user name and Email.

Thanks,
Nishan Patel.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic