tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Bayern <>
Subject Re: input:select
Date Mon, 30 Jul 2001 14:18:22 GMT
On Mon, 30 Jul 2001, Florian Brunner wrote:

> I'm currently using the jakarta taglib input in my JSP. With
> input:select you have to specify the options as a Map. But I want the
> list to display the values in the same order I added them to the Map!
> How can I do that? Can I use TreeMap? But then how to configure the
> Comparator?

Yeah, that's exactly the problem with a TreeMap:  you want order not
against the objects themselves but against the sequence in which they were
added.  The easiest thing to do is to construct your own simply Map that
has this property (e.g., that uses a Vector as its back-end).  I've been
meaning to provide such a utility class along with the Input taglib, but
I've been occupied with JSPTL and other stuff, so it hasn't been a
priority.  If anyone would like to contribute it, that would be quite
welcome, as this is a pretty common question...



View raw message