File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Sequence of Parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Sequence of Parameters" Watch "Sequence of Parameters" New topic

Sequence of Parameters

Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1599
hi guys!
Hope you are doing good. I am just not able to figure out why the sequence of parameters gets interchanged here.

My JSP page is like...

and here is the servlet processing behind...

Surprisingly, in browser i get these elements as "bca", "abc", "submit" and "cab" in that order. why so?

Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

The request parameter name and values represent key-value pairs and hence I would imagine that it would be stored as a Map in the request object. And being a Map, there is no order guaranteed. Neither should it be of any consequence.

Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3640
Akhilesh, do you required that parameter should be ordered? If, yes, I can sugget some work around.

My blood is tested +ve for Java.
I agree. Here's the link:
subject: Sequence of Parameters
It's not a secret anymore!