java web部分知识

1.get和post的区别?

get方法用于获取由Request-URI所标识的资源的信息,常见形式是:GET Request-URI HTTP/1.1

GET/test/LoginServlet?username=hello&password=world HTTP/1.1

post方法用于向服务器发送请求,要求服务器接受附在请求后面的数据。post方法在表单提交的时候用的最多。

POST/test/LoginServlet HTTP/1.1

..............................

Connection:Keep-Alive

username=hello&password=word

1)浏览器地址呈现的结果不同(表象)

2)真正的原因是向服务器发送请求的形式是不同的。

3)get的请求方式      GET/test/LoginServlet?username=hello&password=world HTTP/1.1

4)post的请求方式     POST/test/LoginServlet HTTP/1.1

注意:通过浏览器进行文件上传时,一定要使用post方式而决不能使用get方式。

你可能感兴趣的:(java web部分知识)