hi!
thanks for that.
no the values are not application wide, they may change depending on the sequence of user actions.
LabelValueBean sounds like an excellent idea
thanks
cheers
ajay



From: Jeff Kyser <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Subject: Re: html:options
Date: Sun, 12 Oct 2003 09:51:17 -0500

name/value pairs from a database are handled nicely
in a list of LabelValueBeans.

I'd pull the code to load that list from the database out
into a model class, or perhaps into a Singleton loaded
by an InitServlet (at startup - if the contents weren't
changing, or were at least application-wide)

Then let your actions access the application-scoped
AgencyList instead of doing the work themselves.
And you can iterate the AgencyList in your JSPs,
dealing with both names and values, or just values -
whatever you want.

-jeff

On Sunday, October 12, 2003, at 09:33 AM, ajay brar wrote:

hi!
i have the following scenario
in my database i have an Agency table(which includes the attribute AGENCY_ID) and a Client tables(which includes a AGENCY_ID that maps to the id in the Agency table)
agencies are created first through a web interface.
after that you create Clients. what i want is that when you are filling in the details for the client, i want a drop down list that includes the AGENCY_ID of all agencies that are in the database. so the person fiiling in the info can select a particular AGENCY_ID for that client)
right now in my ClientForm, i have an int agencyId. i want this populated on the basis of the selection made form the drop down list.


how do i do this? any suggestions?
i'm thinking of reading all agencies, chucking them into a collection, placing the collection in the session context and then reading off it in the jsp page using html:options


The downside to that is that my ClientAction forwrads to client.jsp(where you add client details). And i do not particularly want to put all the Agency reading bit into ClientAction.
I could use a separate Java class, but i have an action DisplayAgency that reads all the agencies from the database, adds them to a User bean, puts this in session context and later the page this action forwards to uses logic:iterate to move through the collection in the User bean and display it. Having another Java class to read only the id's and put them in a collection and place this in sesision seems like duplicatng an existing task(with sme minor differences)


are there any other ways of doing this?

thanks
cheers
ajay

_________________________________________________________________
Chat via SMS. Simply send 'CHAT' to 1889918. More info at http://ninemsn.com.au/mobilemania/MoChat.asp?blipid=6800



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
Chat via SMS. Simply send 'CHAT' to 1889918. More info at http://ninemsn.com.au/mobilemania/MoChat.asp?blipid=6800



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to