How do I retrieve parameters in the exact order in which they appeared on the HTML form? The method getParameterNames() does not preserve the order.

Alex Chaffee

Use request.getQueryString() and parse the list in order yourself. You can use a StringTokenizer, something like this (untested code):

StringTokenizer st = new StringTokenizer( request.getQueryString(), "&" );
while (st.hasMoreElements()) {
  String token = st.nextToken();
  String name = token.substring(0, token.indexOf("="));

See also

By the way, the parameters are not guaranteed to be sent over in the order they were on the page, but I think most browsers do that anyway.