This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Datagrid in struts page 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 "Datagrid in struts page" Watch "Datagrid in struts page" New topic
Author

Datagrid in struts page

luckay win
Ranch Hand

Joined: Sep 21, 2010
Posts: 36
Hi,

Can anybody share a code with me for displaying a datagrid in a struts page? The data will be populated from DB and filled in grid.

Is there any other way to display such data on jsp page?

Rgs,
Johannes Geppert
Ranch Hand

Joined: Jan 12, 2010
Posts: 67
There exists two proper ways for grids.

The first is the displaytag taglib which work well with struts2 together.
The other soultion is the Struts2 jQuery Grid Taglib which provide a more dynamic Grid.

Displaytag:
http://displaytag.sourceforge.net/1.2/

Struts2 Grid Showcase with Examples:
http://www.weinfreund.de/struts2-jquery-grid-showcase/index.action

Johannes

My Java and Webprogramming Blog
luckay win
Ranch Hand

Joined: Sep 21, 2010
Posts: 36
Interested to try:

Struts2 Grid Showcase with Examples:
http://www.weinfreund.de/struts2-jquery-grid-showcase/index.action

but it does not have a tutorial for getting the data displayed into the grid..

hmmm.. any body have tutorial for doing this??

I need advise..

many thanks in advance

Regards
Luc
Johannes Geppert
Ranch Hand

Joined: Jan 12, 2010
Posts: 67
Have you take a look at the Project Wiki?

http://code.google.com/p/struts2-jquery/wiki/GridTag

And in both showcases are several examples.

Johannes
luckay win
Ranch Hand

Joined: Sep 21, 2010
Posts: 36
Yes,
I also have tried it .. and got little bit answer.. but still don't know how to display records into the grid?
and refer to the example..I also don't understand what is in CustomerDAO?

Could you please advise what is in CustomerDAO? ..and how do I show records into the grid? (ie. select from mytable order by myfield)

I also have registered to http://code.google.com and have added a comment.. still no luck
Johannes Geppert
Ranch Hand

Joined: Jan 12, 2010
Posts: 67
there exists several tutorials which shows you how to access a database.

http://techblog.zabuchy.net/2010/spring-hibernate-maven-struts2-integration-tutorial/
http://techblog.zabuchy.net/2010/spring-hibernate-maven-and-struts2-integration-tutorial-part-2/

The CustomerDao can be a class which access the Database you prefer
and map the result to an Java Object.

For the Struts2 jQuery Grid Plugin you need to use the json plugin.
which transform your database result in a json object.



Johannes Geppert
Ranch Hand

Joined: Jan 12, 2010
Posts: 67
Maybe also this tutorials helps you out.

http://javanus.com/blogs/?p=182
luckay win
Ranch Hand

Joined: Sep 21, 2010
Posts: 36
I am learning what you wrote on http://www.weinfreund.de/struts2-jquery-showcase/index.action
I have downloaded the source codes..

I tried to read the source codes ..and currently I am on JsonTable.java..
I met the following stack trace below:

HTTP Status 500 -

type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.UnsupportedOperationException: Not supported yet.

it thrown on this line below:


public String execute()
{
log.debug("Page " + getPage() + " Rows " + getRows() + " Sorting Order " + getSord() + " Index Row :" + getSidx());
log.debug("Search :" + searchField + " " + searchOper + " " + searchString);

Object list = session.get("mylist"); // this line thrown the above exception


please help

thanks & regards
Winan
luckay win
Ranch Hand

Joined: Sep 21, 2010
Posts: 36

any clue? .. how to show records to the grid?
the codes below compiled with no errors or warnings .. but still unable to show the records array into the grid.. it seems like the gridModel does not effect the .jsp page..



dips pandey
Greenhorn

Joined: Nov 13, 2010
Posts: 4
I Have been facing the same problem no error but my grid does not get populated with values please help..need to resolve this.
Johannes Geppert
Ranch Hand

Joined: Jan 12, 2010
Posts: 67
without some informations, it is impossible to help you?

How looks your config and code? Do you have check your JSON result?

Johannes
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Datagrid in struts page
 
Similar Threads
datagrid in struts
How to fix header in struts datagrid
struts layout datacolumn
Using datagrid for taking input.
displaying 2 datagrids so as to avoid NullPointerException