File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Options Lists, in db or what Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Options Lists, in db or what" Watch "Options Lists, in db or what" New topic
Author

Options Lists, in db or what

Siamak Saarmann
Ranch Hand

Joined: Aug 21, 2004
Posts: 78
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


PhD Artificial Intelligence, OCJP1.6
Siamak Saarmann
Ranch Hand

Joined: Aug 21, 2004
Posts: 78
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

Joined: Apr 14, 2004
Posts: 10336

Not an ORM question. Moving to Servlets etc.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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 ?


[My Blog]
All roads lead to JavaRanch
Darren Edwards
Ranch Hand

Joined: Aug 17, 2005
Posts: 69
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

Joined: Aug 21, 2004
Posts: 78
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Options Lists, in db or what