This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Get and Post Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Get and Post" Watch "Get and Post" New topic

Get and Post

Abdul Kalam

Joined: May 28, 2001
Posts: 5
I am calling the post method of the servlet with the following url
<form name=frm1 method=post action="..?aa=12&bb=13">
<input type=hidden name=hid1 value=10>
in the called servlet i am able to retrieve all the parameters how is this happening.
Also if i try to do it using get then the values are overwritten and only vaue of hidden variable is obtained.

Abdul Kalam
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

when you 'post' data, it uses a separate stream. So both the querystring you have built in the action tag, and the posted form data will make it to the servlet.

when you 'get' data, then only a query string is sent. I have not tried it out, but from what you are saying, it appears that the querystring is overwritten by your browser, and so it ignores the querystring already written in the action tag.
Cameron Park
Ranch Hand

Joined: Apr 06, 2001
Posts: 371
In GET, the query string is appended to the end of the requested URL. In POST, the parameters are sent within the body of request in a urlencoded format.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Get and Post
Similar Threads
HTTP POST - URL Encoding
GET Method Working But POST is not
Authentication with JDBC Realms and MVC pattern (Controller servlet)
sendRedirect fails to post data along with url if the data is too large
Tompcat - calling servlet from JSP