struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ian_d_stew...@bankone.com
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
attributes.

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'.


HTH,
Ian

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




"Sinclair, Mark" <msinclair@eds.com> on 06/10/2003 08:30:00 AM

Please respond to "Struts Users Mailing List"
      <struts-user@jakarta.apache.org>

To:   struts-user@jakarta.apache.org
cc:

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
drop-downs,
lists etc?

For example say from a simple Logon page I forward to a Supplier List
screen
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
list.

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
logic:iterate
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
other
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
appreciated!

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org









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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message