I have an html form which posts data to a servlet. However the order returned in getParameterNames() isn't the same as in the HTML Form.
How do i retrieve the parameters in the same order?
I have an html form which posts data to a servlet. However the order returned in getParameterNames() isn't the same as in the HTML Form.
How do i retrieve the parameters in the same order?
The parameters in the request are stored in a Map. A map do not warranty the order of iteration. If you really need to get the records in a particular order I suggest to add the order in the name property something like 01_firstName 02_last name and then order the map.
This came up as a bug in Apache Tomcat a little while ago. The short version of that bug report is:
This has been fixed in Tomcat 8.0.x for 8.0.0-RC4 onwards and in 7.0.x for 7.0.45 onwards.