struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Levin" <>
Subject Re: Is there a clean way to also get non-value names from a form????
Date Wed, 24 Apr 2002 07:10:13 GMT
My approach to this has been as follows:

Cache the key-value pairs associated with the lookup table. My
approach is to have a bean in the servlet session that keeps
these values.

In the results page, use a custom tag which iterates through the
lookup table keys until it matches the key in the result, then
grab the value associated with that key and display it, e.g.

<misc:lookupMatch lookupBean="countryCodeLookups"

This would extract the countryCode for a corporation, e.g. CA
and match it against the list of pairs in countryCodeLookup
(this would store CA -> Canada, US -> United States, etc...), then
display the matched value, so Canada would end up being displayed
if the countryCode was CA.

>From: Rick Reumann <>
>Reply-To: Rick Reumann <>
>To: Struts Users Mailing List <>
>Subject: Is there a clean way to also get non-value names from a form????
>Date: Tue, 23 Apr 2002 23:47:58 -0400
>MIME-Version: 1.0
>Received: from [] by (3.2) with ESMTP id 
>MHotMailBE8F7627002640043721C0123183C5850; Tue, 23 Apr 2002 20:48:55 -0700
>Received: (qmail 11808 invoked by uid 97); 24 Apr 2002 03:48:51 -0000
>Received: (qmail 11797 invoked from network); 24 Apr 2002 03:48:51 -0000
>>From struts-user-return-32868-aphelionx Tue, 23 Apr 2002 20:50:09 -0700
>Mailing-List: contact; run by ezmlm
>Precedence: bulk
>List-Unsubscribe: <>
>List-Subscribe: <>
>List-Help: <>
>List-Post: <>
>List-Id: "Struts Users Mailing List" <>
>Delivered-To: mailing list
>X-Mailer: The Bat! (v1.60c) Personal
>X-Priority: 3 (Normal)
>Message-ID: <>
>X-Spam-Rating: 1.6.2 0/1000/N
>Sorry if this isn't really a struts specific problem per se, but I've
>encountered it now while rewriting an application with struts...
>Using struts tags picture the output being generated like:
><option value="1">DOG</option>
><option value="2">CAT</option>
><option value="3">FROG</option>
>Picture several of these multiple select drop downs that are used to
>generate a search based on the criteria selected. The problem is on
>the search results page I also want to include a display of the
>options selected for the different search criteria. I'd be interested
>in hearing how others have accomplished this task using struts.
>Before using struts I wasn't populating a form bean so what I would do
>is when the values were created I would create values like:
>I would then parse out the first numbers for use in the query and then
>use everything after the first underscore to build an array for
>displaying search selections.
>In my current application the option lists are generated dynamically
>from ArrayLists of particular beans. If the situation was as simple as
>above I'd just have a nice little HashMap stored somewhere where I
>could have the key be the number and the value by the String for the
>animal. Unfortunately a Map doesn't really work well for this as the
>ArrayList of beans coming from the business logic contain a lot more
>than just two fields.
>I don't really like this idea much but I'm thinking what I'll have to
>do is create extra fields in the form bean to represent this
>concatenated value and when it the setter is called it will also parse
>what it needs to and set the other fields. Is there maybe a better to
>do accomplish this task?
>Thanks for any input.
>"Maybe in order to understand mankind, we have to look at the word
>itself: 'Mankind'. Basically, it's made up of two separate words -
>'mank' and 'ind'. What do these words mean ? It's a mystery, and
>that's why so is mankind."
>   -Jack Handey
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 

Send and receive Hotmail on your mobile device:

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

View raw message