This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
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 ]
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