有一部分是原创,有一部分是转载,转载的我会在开头写上地址,原文写的很好
1.转载至http://hongjiang.info/http-application-x-www-form-urlencoded/
在servlet规范3.1.1节里,对POST数据何时会被当做parameters有描述:
1. The request is an HTTP or HTTPS request.
2. The HTTP method is POST.
3. The content type is application/x-www-form-urlencoded.
4. The servlet has made an initial call of any of the getParameter family of methods on the request object.If the conditions are met, post form data will no longer be available for reading directly from the request object’s input stream.
规范里已经明确的声明当请求满足: 1) http/https, 2) POST, 3) Content-type 是application/x-www-form-urlencoded
, 4) 调用过getParameter方法;则数据会被当做请求的paramaters,而不能再通过 request 的 inputstream 直接读取。
2.对于jquery中获取值得三个方法:
⒈ val():获取属性的值,比如input表单项中name属性对应的value值;
⒉html():获取标签之间的html代码(包括文本值和html代码)
⒊text():获取标签之间的文本值(只获取文本值,不会处理标签之间的html代码。)