• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Datagrid in struts page

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
luckay win
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe also this tutorials helps you out.

http://javanus.com/blogs/?p=182
 
luckay win
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 36
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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..



 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 67
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
without some informations, it is impossible to help you?

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

Johannes
 
And will you succeed? Yes you will indeed! (98 and 3/4 % guaranteed) - Seuss. tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic