• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using a Collection or Array

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a strange situation. I have a form and 5 of the form fields are user defined. So I have a table in my database that contains a userid and then 5 userdefined columns. The user can go into his profile and set each user defined column to be whatever he wants.
Now, when the Input Form is displayed I want to replace the User Defined n label with whatever the user has defined for his columns.
My question is basically the best approach to do this without using too many scriplets.
My first idea was to add a parameter to my UserBean that basically holds in a collection or array of some sort all 5 of these and then to use that UserBean in my JSP page to display the Labels. Is this a good idea?
My other idea was to make a seperate Bean that was UserDefinesBean and just 5 parameters, 1 for each UserDefined column, and use that bean in the JSP page. Is this a good way?
Is there a better way?
[ September 24, 2003: Message edited by: Gregg Bolinger ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The choice comes down to deciding the approriate level of abstraction for the set of user-defined labels. If the labels are useless outside of the User context, there should be no issue bundling them with the User. If the labels are more autonomous, or even if they have the potential to be in the future, I'd abstract them away from the User. [Confession: in my own code I have a tendency to favor abstraction, so I'd probably keep them separate from the User context even if I didn't think they'd ever be used separately.]
hth,
bear
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear. I will probably keep it as a seperate Bean. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic