If I print all parameter with a servlet like this :
i'll have this result :
What i want to show is that the request object got all parameters, those send in the url and those send in the request body thanks to the POST method.
Is there a way to get only parameters send in the body request only??
For exemple in PHP you can get $_GET and $_POST, is there an equivalent in java?
And mixing parameters on the query string (it's still not a "get") with those in the request body is considered very bad form. For a POST, the params should be in the body and there shouldn't be any on the query string.
Hum ok, i don't understand why it's a bad practice.
Imagine i'm consulting a client at the url client?id=3. In this page i have a form to modify the client informations. This form action is still client?id=3.
In my servlet, in the doPost i perform all action needed to update the client, in the doGet i forward to the jsp which present all information of the client. And the end of my doPost I call doGet to avoid duplicate code.
In my form, i could put the id into an input hidden, but since my url to consult my client is client?id=3, i don't feel that logical.
Here my example is not totally pertinent because i need the client ID in my doPost but imagine a parameter in the query string that is not needed in the doPost and really needed in the doPost, for exemple a page number.
I really don't understand why it would be a bad idea to mix parameters, i really need that the client (the browser) return at the exactly same url after the doPost...
PS: I'm not a Java expert and i don't try to prove something, i don't have the knowledge for that, i just try to understand