我的代码如下所示,并打印出客户端的所有输入。HTTP Post issue
除此之外,当我尝试阅读,无后数据来自通过......
while ((s = input.readLine()) != null){
System.out.println(s);
}
我的帖子的数据:
POST/HTTP/1.1
Host: localhost
Connection: keep-alive
Content-Length: 27
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Origin: (http://) localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22
Content-Type: application/x-www-form-urlencoded
Referer: (http://) localhost/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
所以我不收到任何数据,除了我把表格放入我的HTML中
<form method="post">
TestText: <input type="text" name="test1"><br>
TestText2: <input type="text" name="test2">
<input type="submit" value="Submit">
</form>
那么有什么想法?
我编写自己的HTTP服务器,所以我已经实现了一个方法来获取POST,GET和其他的东西
你使用Apache HttpClient或Servlet或其他技术? – 2013-03-04 17:35:27
我可以看到您的表单没有任何操作,可能会导致问题。 – 2013-03-04 17:36:37
如果它没有操作属性,它会自行发布。我不知道这是他想做的事。 – 2013-03-04 17:38:25