前台ajax中的data数据既有数组又有字符串controller层怎么接收
展开全部
//service interface
void receiveData(Map<String, Object> map);
//service impl
public void receiveData(Map<String, Object> map) {
System.out.print(map.get("msg"));
}
//action
private Dao dao;
public void sayHello() {
String msg = ServletActionContext.getParameter("msg");
Map<String, Object> map = new HashMap<String, Object>();
map.put("msg", msg);
dao.receiveDate(map);
}
//ajax
$.post("/zhidao/answer.htm",{"msg" : "hello"},function(){});
void receiveData(Map<String, Object> map);
//service impl
public void receiveData(Map<String, Object> map) {
System.out.print(map.get("msg"));
}
//action
private Dao dao;
public void sayHello() {
String msg = ServletActionContext.getParameter("msg");
Map<String, Object> map = new HashMap<String, Object>();
map.put("msg", msg);
dao.receiveDate(map);
}
//ajax
$.post("/zhidao/answer.htm",{"msg" : "hello"},function(){});
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询