struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Reumann <>
Subject Is there a clean way to also get non-value names from a form????
Date Wed, 24 Apr 2002 03:47:58 GMT
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: <>

View raw message