Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

best java data type to use for display of records on jsf .xhtml page

 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello -

I am playing around with jsf and richfaces again after taking a long break to learn pl sql. I left off in college so I am still learning best practices.

I want to connect to a database, grabbing 4 columns out of 50 records (basic stuff - first_name, last_name, address, city - just practice). I then want to display those 50 records on my page using either jsf or preferably richfaces.

What data type(s) should I use to hold the data returned from the database?
Should I put each column's results in an array?
If I do that will it be difficult to match up first_name to last_name to city, etc?
Or should I consider a mutlidimensional array? Or some other data type?
What jsf/richfaces component is going to be best to display these records?

Thanks for any answers to those questions.
 
Stefan Evans
Bartender
Posts: 1691
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Should I put each column's results in an array?
No. You should not.
>If I do that will it be difficult to match up first_name to last_name to city, etc?
That is something that should be left up to the framework.
>Or should I consider a mutlidimensional array?
No.
> Or some other data type?
Yes.

Have you considered an Object?
Define an object to store this information. eg Person.
One instance of an object == one row in the database
Your object attributes map to columns in the database.
You then return to your page a list of Person objects to display.

> What jsf/richfaces component is going to be best to display these records?
If you have a list of Person objects available, then Datatable seems to be the popular choice.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic