• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sequence of request parameters

 
Reema Patel
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,
1. Based on my experience with some servlets, I belive that there's no order by which request paremeters are sent. I'm using a simple servlet where I'm getting a java.util.Enumeration from ServletRequest.getParameterNames() method and then printing each param value. But, the params are retrieved but not in the order they were rendered by the HTML page.

2. GET is the default HTTP method. I have a servlet which doesn't overide the doGet() method. Pls. Consider the following two cases:


(a)When I post a form data which explicitly says METHOD=POST, I get the expected HTTP 405 error- method not supported.
(b) But, when I ommit any method, i-e METHOD= I don't get any error, instead the page gets refreshed. Why don't i get an error in this case also?

Any help shall be highly appreciated.

Thanks,
Reema
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should ask separate questions in separate threads.

There is no default ordering for parameters. Even if you worked out how one server ordered them, you may find the next version ordered them completely differently.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both observations are correct.

There is no defined order for request parameters.
Get is the default request type for a form submission.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As for question 2, it is not difficult to debug a request through the Tomcat server, if you either looked at the code of the service method or attached a debugger it should help with the answer.

Dave
 
Reema Patel
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks rachers!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even if all browsers sent parameters in the same order as the HTML form, you would not be able to see that order because the HttpServletRequest parses them into a Map of some sort.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic