Originally posted by Jeanne Boyarsky:
I have a select list with multiple options enabled (<select multiple> and up/down JavaScript to control the order. I'm trying to confirm or refute that calling request.getParameterValues() will return them in the order they are on the screen. It appears to preserve the order from a test.
How would I verify this is not coincidence? Does anyone either know the answer or know where I would look this up?
The ordering of the request parameters isn't required by the HTML specification, so webbrowsers and appservers doesn't need to respect it. Besides, the parameterMap in
servlets is backed by a HashMap. You know, HashMaps does not guarantee the ordering of the items as is with the insertion order.
I would populate a hidden input element with the IDs/keys/whateveridentifiers of each item commaseparated in the desired order and base your logic on that instead.