When you get a doGet or doPost call in a servlet, you can use it getparameterxxx()
to get the query string or message data in one convenient place.
If the call was GET, you get the data from the url / query string.
If the call was POST, you will receive all the data after you.
Except, as it turns out, if you don't put the action attribute in your form call. If you specify a fully or partially qualified URL for the action parameter, everything will be fine, if you do not, the browser will call the same URL as on the previous page, and if there are query string data there, you will get this. as well as POST data, and there is no way to tell them apart.
Or is there? I look at the request object, I see where the mail data comes from, I just try to find out where the GET data comes from, so I can erase the GET data on a subsequent call and erase the message data to the GET call before analyzing it, if possible.
Any idea what a safe way to do this?
And I think you never tried to put an action field in a form tag. :-)
source
share