Hi,

The values are passed in the same format you saw for the GET, only
in the message body.  The Servlet API makes this pretty transparent
for you and will provide both sets of parameters via
ServletRequest.getParameter().

Advantages of POST: longer parameter lists possible
Advantages of GET: if you want the parameters to be part of a
"bookmarkable" URL.

Cheers,

--Amos

> -----Original Message-----
> From: Vivin Kumar P [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 22, 2000 10:21 AM
> To: [EMAIL PROTECTED]
> Subject: GET POST Difference
>
>
> Hi Everybody,
>
> I have a sort of basic doubt in the GET and POST METHODS.
> Well I have a HTML like this and Iam calling a servlet with
> the FORM data.
>
> <HTML><TITLE>Form Test</TITLE>
> <BODY>
> <FORM NAME="frmTest" METHOD="GET" ACTION
> ="http://vivin/servlets/TestServlet">
> <INPUT TYPE=TEXT NAME="txtVal" VALUE="Hello World" LENGTH=20>
> <INPUT TYPE=SUBMIT>
> </FORM>
> </BODY>
> </HTML>
>
> When we use  METHOD="GET" the values are passed as query string like,
>
> "http://vivin/servlets/TestServlet?txtVal=Hello+World"
>
> So I know how the values are passed to the server. The header
> request from
> the
> browser to the server will be like this:
>
> GET /servlets/TestServlet?txtVal=Hello+World HTTP/1.1
> Accept: application/vnd.ms-excel, application/msword,
> application/vnd.ms-powerpoint, image/gif, image/x-xbitmap, image/jpeg,
> image/pjpeg, */*
> Accept-Language: en-us
> Accept-Encoding: gzip, deflate
> User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)
> Host: vivin
> Connection: Keep-Alive
>
>
> But when we use METHOD="POST" the URL is just,
>
> "http://vivin/servlets/TestServlet"
>
> and the request to the server is something like this,
>
> POST /servlets/TestServlet HTTP/1.1
> Accept: application/vnd.ms-excel, application/msword,
> application/vnd.ms-powerpoint, image/gif, image/x-xbitmap, image/jpeg,
> image/pjpeg, */*
> Accept-Language: en-us
> Content-Type: application/x-www-form-urlencoded
> Accept-Encoding: gzip, deflate
> User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)
> Host: vivin
> Content-Length: 18
> Connection: Keep-Alive
>
> Now where is the values being passed to the server?
> Are the values passed back to the server at all in a POST method?
>
> Any help is appreciated.
>
> Thanks in advance,
> Vivin.
>
> ______________________________________________________________
> _____________
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to