This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to retrieve parameters in the exact order?  RSS feed

 
Reda Mokrane
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm using request.getParameterNames() to retrieve parameters but it does not preserve the order in which they appeared on the HTML form. My application does not depend on the order of parameters but I just want to know if It is possible to retrieve the parameters in the exact order?
thanks for any idea.
Thanks,
Mokrane
 
Tim Holloway
Bartender
Posts: 18705
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can always get the query string from the string and parse it yourself. As far as I know, however, the parameters are allowed to be placed in an unordered hash. Do a "search" on the JavaRanch and you may find this topic discussed in detail about a month or so back.
Since that forum was just split into separate Servlet and JSP forums I have no idea what the best way to look would be, though...
 
ersin eser
Ranch Hand
Posts: 1072
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not very experienced in this area but easy way might be to name your fields on HTML in some kind of order by prefixing "a thru z" for example and then use Collection.sort(List list) on the servlet side after retrival Again I am not an expert and never needed to do this.
 
mou haj
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do
recSrNoMan=request.getParameterValues("recSrNoManHid");
recSrNoManHid --- html variable
nad
String[] recSrNoMan= {};
so as many values are there will fit in the array
 
Reda Mokrane
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all your help.
Reda Mokrane
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!