struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Populating Drop-down
Date Tue, 10 Jun 2003 12:44:23 GMT

I don't know if it's a best practice or not, but what I do is have the link
to the edit screen actually point to an action, which is responsible for
initializing any related collections and storing them in session-scoped

A related approach would be to use the <logic:notPresent> tag to check for
the collections, and only initialize them when necessary.  This has the
advantage of dealing with issues such as session timeouts and users
accessing the edit screen through other than 'official channels'.


Ian D. Stewart
Open Systems Engineer II
Enterprise Midrange - Bank One Infrastructure & Operations
(614) 213-6100

"Sinclair, Mark" <> on 06/10/2003 08:30:00 AM

Please respond to "Struts Users Mailing List"


Subject:  Populating Drop-down

I am a newbie to struts.  This is a simple question and is not totally
specific to Struts but is related to the best way to use struts.  I am
trying to find out what is the recommended approach for populate
lists etc?

For example say from a simple Logon page I forward to a Supplier List
displaying all the current suppliers that are stored in the DB.
Each supplier in turn is responsible for a certain department (field in
department table in DB and departments stored in another DB table).
In the supplier list I display the actual department name that they
correspond to.
Now from selected supplier on list if I go to an editSupplier.jsp I want to
give the user the ability to pick a different department from populated

My question is what is the best way to pass the list of departments to the
View (editSupplier.jsp).

Should my SupplierForm Bean contain a property eg departments that is an
ArrayList or collection of departments in the DB then populate into view
using the <html:options> tag?

Or if Departments list is used in multiple screens should it be loaded into
the session (/request) on logon (or whenever relevant) and use
to populate the drop down.

I may have a number of these types of drop-down lists, should I just
prepopulate them into collections in my "user" session object?  How do
people handle this?  All examples I have seen just use hard-coded drop-down
values in the jsp without retrieval from DB.  Any help or pointers much

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

This transmission may contain information that is privileged, confidential and/or exempt from
disclosure under applicable law. If you are not the intended recipient, you are hereby notified
that any disclosure, copying, distribution, or use of the information contained herein (including
any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error,
please immediately contact the sender and destroy the material in its entirety, whether in
electronic or hard copy format. Thank you.

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

View raw message