2017-03-10 20:29
@JFinal $(function(){
//按钮单击时执行
$("#testAjax").click(function(){
var condition = {"filterCondition":[{"unitCode":"0001","registralCode":"21603201152013120008","nextInspectingDate":"2018-11-01"},{"unitCode":"0001","registralCode":"21603201152013120009","nextInspectingDate":"2018-17-01"}]};
$.ajax({
type: "post",
cache: false,
url: "vessel/queryVesselListByDate",
data: condition,
dataType: 'json',
//contentType: 'application/json;charset=utf-8',
success: function (data) {
$("#msg").html(data.pressureVesselList);
},
error: function (e) {
$("#msg").html(e.message);
}
});
});
});
必须把contentType: 'application/json;charset=utf-8',注释掉,但注释掉后HttpKit.readData(getRequest());和getPara("filterCondition");都拿不到值,可以通过Enumeration paraNames = getParaNames();
for(Enumeration e=paraNames;e.hasMoreElements();){
String thisName=e.nextElement().toString();
String thisValue=getPara(thisName);
System.out.println(thisName+"--------------"+thisValue);
}遍历。
JFinal action report -------- 2017-03-10 20:21:06 ------------------------------
Controller : controller.VesselController.(VesselController.java:1)
Method : queryVesselListByDate
Parameter : filterCondition[0][unitCode]=0001 filterCondition[0][registralCode]=21603201152013120008 filterCondition[0][nextInspectingDate]=2018-11-01 filterCondition[1][unitCode]=0001 filterCondition[1][registralCode]=21603201152013120009 filterCondition[1][nextInspectingDate]=2018-17-01
--------------------------------------------------------------------------------
如果注释不去掉,那么HttpKit.readData(getRequest());可以获取到filterCondition%5B0%5D%5BunitCode%5D=0001&filterCondition%5B0%5D%5BregistralCode%5D=21603201152013120008&filterCondition%5B0%5D%5BnextInspectingDate%5D=2018-11-01&filterCondition%5B1%5D%5BunitCode%5D=0001&filterCondition%5B1%5D%5BregistralCode%5D=21603201152013120009&filterCondition%5B1%5D%5BnextInspectingDate%5D=2018-17-01,但getParaNames和getPara都获取不到值,
JFinal action report -------- 2017-03-10 20:27:01 ------------------------------
Controller : controller.VesselController.(VesselController.java:1)
Method : queryVesselListByDate
--------------------------------------------------------------------------------
不知道什么原因
2017-03-10 20:19
@JFinal JFinal action report -------- 2017-03-10 20:17:31 ------------------------------
Controller : controller.VesselController.(VesselController.java:1)
Method : queryVesselListByDate
Parameter : filterCondition[0][unitCode]=0001 filterCondition[0][registralCode]=21603201152013120008 filterCondition[0][nextInspectingDate]=2018-11-01 filterCondition[1][unitCode]=0001 filterCondition[1][registralCode]=21603201152013120009 filterCondition[1][nextInspectingDate]=2018-17-01
这样如何解析啊?
2017-03-10 17:36
@JFinal JFinal action report -------- 2017-03-10 17:35:36 ------------------------------
Controller : controller.VesselController.(VesselController.java:1)
Method : queryVesselListByDate
没有parameter