How about adding some JavaScript to update the value of a hidden input to
contain the key? That way you get both the key and the value submitted as
request params.

Quoting Helios Alonso <[EMAIL PROTECTED]>:

> Can't you change the whole thing to work always with the key, and only do 
> the key->value mapping?  Or maybe you can have a bean with both mappings:
> 
> UsersBean
> + idByUserName: Map
> + userNameById: Map
> 
> if you really need it (it is, in case both key and value are valid "codes" 
> and not only final results).
> 
> At 04:33 10/10/2004 +1000, you wrote:
> >G'day,
> >
> >Ummmmmm, this returns the value associated with the key... I need to do the
> >opposite whereby I have the value and I need it's key.
> >
> >Thanks.
> >AB
> >
> >-----Original Message-----
> >From: Tim Troy [mailto:[EMAIL PROTECTED]
> >Sent: Saturday, 9 October 2004 10:33 PM
> >To: [EMAIL PROTECTED]
> >Subject: FW: [JSTL] Retrieving the key from a LinkedMap for a known value?
> >
> >
> >I have a bean with a HashMap named errorCodes.  To access a key using jstl,
> >I do the following:
> >
> ><c:out value="${bean.errorCodes['categoryId']}"></c:out>
> >
> >-----Original Message-----
> >From: Adrian Beech [mailto:[EMAIL PROTECTED]
> >Sent: Saturday, October 09, 2004 1:59 AM
> >To: 'Tag Libraries Users List'
> >Subject: [JSTL] Retrieving the key from a LinkedMap for a known value?
> >
> >
> >G'day all,
> >
> >Is it possible to retrieve the key from a LinkedMap for a known value using
> >the expression language syntax under JSTL 1.0?
> >
> >For example, I have a LinkedMap object which is being used to generate a
> >drop down with the <input:select .../> tag from the Input taglib.  Apart
> >from needing the value selected by the user from the drop down I need to
> >pull the corresponding key for display purposes on the next page along in
> >the food chain.  As I've already got the key/value pairs in a LinkedMap
> >within the session context I was hoping to merely say "well here is the
> >value from the drop down now give me the key which was used as the display
> >text for that drop down".
> >
> >Does this sort of make sense?
> >
> >AB

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

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

Reply via email to