• Post Reply Bookmark Topic Watch Topic
  • New Topic

Bean array -> JSP page

 
Dave Purnell
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,
I'm very new to all this Java & web technology, but I think I'm catching on. There's just this one problem that's got me stumped right now...
From a search page I'm calling a servlet to grab an array of clients based on the search criteria then display these clients (client number, name & address) in a table on a results page.
Should this array of clients be created by having an array of beans, where each bean would hold the information for 1 client, or would it be better (easier) to have just 1 bean with an array of each of the client attributes inside?
What would then be the best way of displaying the result bean(s) on a JSP page?
thanks,
Dave
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you plan to use beans at all, then an array (or List) of beans is a much better choice. Otherwise you have to individually deal with the lengths of several arrays, and add/remove a whole array every time you change which attributes you are interested in.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!