struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandeep Takhar <>
Subject Re: What Is The Proper Location To Place Inputs For Creating A Drop-Down Menu
Date Fri, 18 Jul 2003 13:17:10 GMT
I'd put it in the database.

The value can be the abbreviated state name and the
label can be the resource property that you look up.

You can do something like what I saw in "Struts in
Action" book.

It uses an action in scaffolding contrib project (part
of start) that is called ExistsAttribute that will
check to see if an attribute exists in a certain scope
(I believe specified in the parameter attribute of the
action-mapping).  If it doesn't it goes one way
(forward) or the other.  It passes control to another
action which will load the stuff up in app scope and
then forward to the action that needs the stuff.

I guess the only problem with this scheme is that
states can be used in many different places.  You
would probably have different mappings for each of

Scaffolding also uses a different back-end bean for
each mapping (or many of them).  So you could load
many different beans if you want.

You could have a servlet load the stuff in application
scope if you liked as well.

Lots of different ways of doing this.

LabelValueBeans are part of struts and are useful for
this type of thing.  html:optionsCollections interface
directly with LabelValueBeans and are used within an

Another approach is to have a common jsp using a
TilesController that loads it up if it isn't there

I like the scaffolding approach.  there are ways to
make it dynamically dispatch to the appropriate action
after loading up the beans.  Scaffolding has a number
of built in methods that may work (although I am
thinking they may not).  One is the BaseForm which has
a dispatch parameter and the other is
BaseActionMapping which has a parameter (specified in


--- Caroline Jen <> wrote:
> I want to put the "label and value" pairs of the 51
> states of the U.S. in a file, read in the file into
> an
> ArrayList, and then create a drop-down menu in a
> .jsp
> file.
> Question 1.  Where is the proper place to put those
> "label and value" pairs?  Create a table in the
> database? or put those pairs in a properties file? 
> Which directory does this properties file go?
> Question 2.  Do I read those pairs into an ArrayList
> in the controller servlet?   
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message