Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Options Lists, in db or what

 
Siamak Saarmann
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

In a web application which has lots of option lists, it would be difficulat to put all of those options in separate tables and build data layer etc for every of them. (I used to do this in conventional non-oop languages like PHP, ASP etc. but doing it with Java seems to me difficult).

What do people do (best practice)? (As an example in a web application with 50 forms and 10 options list).

Regards,
Mac
 
Siamak Saarmann
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello again,

Seemd no one has answered the question. I have prepared something and I would appereciate if you tell me your opinion.

I have written a class which has the options inside it (in future these options can come from db).

I have also added some methods which can help me build html forms. Is this good or I should not do this?

Regards,
Mac

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not an ORM question. Moving to Servlets etc.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to point out that :

is probably not what you want to do. You probably want to pass different ids for each item, don't you ?
 
Darren Edwards
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your approach for storing values in the db and retrieving them as needed is fine - remember there is often more than one usable solution for a problem.

You should look at using jsp/jstl to actually display the results though. Consider passing the option objects in some form of list, then using jstl


[ June 09, 2006: Message edited by: Darren Edwards ]
 
Siamak Saarmann
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Satou, yes. It was a mistake. They should be 1,2,3 ...

Darren, thank you very much. Yes , I'd rather use JSTL.

Regards,
Mac
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic