| Author |
best java data type to use for display of records on jsf .xhtml page
|
Matt Kohanek
Village Idiot
Ranch Hand
Joined: Apr 04, 2009
Posts: 483
|
|
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.
|
True wisdom is in knowing you know nothing - Socrates
|
 |
Stefan Evans
Bartender
Joined: Jul 06, 2005
Posts: 1005
|
|
> 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.
|
 |
 |
|
|
subject: best java data type to use for display of records on jsf .xhtml page
|
|
|