• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Options Lists, in db or what

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not an ORM question. Moving to Servlets etc.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
We noticed he had no friends. So we gave him this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic