Servlet怎样接收jquery Ajax传来的数据
$.ajax({type:"POST",url:"../servlet/PortletServlet",data:query,success:handleResponse...
$.ajax({
type: "POST",
url: "../servlet/PortletServlet",
data: query,
success:handleResponse
});
query是名/值对(好多对),在Servlet中怎样接收呢
我是这样写的
String title=request.getParameter("type1");
System.out.println(title);
BufferedReader reader=request.getReader();
StringBuffer xml = new StringBuffer();
String line = null;
while ((line = reader.readLine()) != null) {
xml.append(line);
System.out.println(line);
}
System.out.println(xml.toString());
可是都没用 展开
type: "POST",
url: "../servlet/PortletServlet",
data: query,
success:handleResponse
});
query是名/值对(好多对),在Servlet中怎样接收呢
我是这样写的
String title=request.getParameter("type1");
System.out.println(title);
BufferedReader reader=request.getReader();
StringBuffer xml = new StringBuffer();
String line = null;
while ((line = reader.readLine()) != null) {
xml.append(line);
System.out.println(line);
}
System.out.println(xml.toString());
可是都没用 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询