论坛首页 入门技术论坛

Servlet Get Post

浏览 2562 次
该帖已经被评为新手帖
作者 正文
   发表时间:2007-08-25  

    一个最基本的,也是最不基本的问题.
    http的get方法是将你要传输的数据放在url后的,也就是我们常用的test.jsp?name=aaa&age=10这种格式,数据都是可以通过url就可以看到了,你在网页中的属性就能看到这个url,这是get方法,由于受到http协议的限制,这种方式传输数据有大小限制,1024,为了能够传输更多的数据,你可以采用post,post是将数据放到了http的Content中,这就不受http协议的影响了,而且传输的数据不能直接被看到(登陆的用户名和密码可不能用get哦)。大量的数据或是文件上在数据,都只能用post来传而且get方法提交的页面能够通过history.back()回退,但post的数据就不能,回退时告诉已经过期,应为你已经post出去了,就不能取回来了。  
    简单的说,get是通过http  header来传输数据,有数量限制,而post则是通过http   body来传输数据,没有数量限制.

    下面是rfc文档中查到的资料:

    The Introduction of GET method
    The GET method should be safe, that is, without any side effects,for which users are held responsible. For example, most form queries have no side effects. If a client request is intended to change stored data, the request should use some other HTTP method. GET方法应当是安全的,也就是对于负责的用户不会有边界效应。比如,大多数的查询没有边界效应。如果客户端请求想要修改保存的数据,请求应该使用其他的HTTP方法。The GET method should also be idempotent, meaning that it can be safely repeated. Sometimes making a method safe also makes it idempotent. For example, repeating queries is both safe and idempotent, but buying a product online or modifying data is neither safe nor idempotent. GET方法应该是等幂的,意味着它可以安全地重复。有时使一个方法安全也就是使它等幂。比如。重复查询既是安全也是等幂的,但是在线购买商品或者修改数据则既不安全也不等幂。

 

 
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics