I want to know some details about servlet

what is the difference between GET(doGet method) & POST(doPost method) requests?which of the 2 is advantageous?
[136 byte] By [javalearnerB] at [2007-9-26 3:06:29]
# 1

Really the only difference is symantics. According to Http RFC's the GET method is supposed to indicate a request for resource (i.e., HTML page, document, etc) whereas POST is supposed to indicate a request which will modify data on the server. In practice, POST is usually used in "posting" form data, etc.

That being said, there is really no difference between the two. In fact servlets usually implement these as follows:

public class MyServlet extends HttpServlet {

public void doPost(HttpServletRequest req, HttpServletResponse res)

throws ServletException, IOException {

doGet(req, res);

}

public void doGet(HttpServletRequest req, HttpServletResponse res)

throws ServletException, IOException {

// Processing code...

}

steveEbersole at 2007-6-29 11:09:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hi

Differences are:

1) limited data can be sent thru(about 1kb) GET method

whereas unlimited data can be sent thru POST method.

2) Form field values are concatenated to the URL

( http://www.xyz.com?name1=value1&name2=value2.. ) in case of GET i.e form fields values will be visible in URL which is very dangerous in case of if u send username and password using GET method whereas values are directly posted thru POST and values will be visible

3) GET will be useful in case of URL in hyperlinks and u

want to send some parameters to the Servlet. Sending

parameters to servlet thru hyperlinks is by default sent

using GET method. for eg:

<a href="http://www.xyz.com/ExampleServlet?name1=value1&name2=value2...>ExampleServlet</a>

Vinay

">

psvinayram at 2007-6-29 11:09:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Hi VinayThanx for ur information.Anoop
javalearnerb at 2007-6-29 11:09:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...