我在spring控制器中有这个方法,它返回哈希图。
@RequestMapping(value = "/CIMtrek_Project_Information", method = RequestMethod.POST)
public @ResponseBody Map<String,String> getProjectInfotmation(@RequestParam("cerNo") String cerNo,HttpServletRequest request,HttpServletResponse response) throws Exception {
DataService ds = new DataService();
Map<String,String> projectInforamtionMap = new HashMap<String,String>();
projectInforamtionMap = ds.getProjectInformation(cerNo);
System.out.println("projectInforamtion : "+projectInforamtionMap);
return projectInforamtionMap;
}
这是我使用的jquery ajax方法:
function getProjectInformation(){
var cerNo = document.getElementById('CIMtrek_CI_CER').value;
$.ajax({
type: "POST",
url: "CIMtrek_Project_Information",
data: {
cerNo: cerNo
},
success: function (projectInforamtionMap) {
if(projectInforamtionMap.norecord !="yes"){
document.getElementById('projectNo').innerHTML=projectInforamtionMap.CI_Used_By_ProjNo;
document.getElementById('CIMtrek_CI_Used_By_ProjNo').value=projectInforamtionMap.CI_Used_By_ProjNo;
document.getElementById('projectName').innerHTML=projectInforamtionMap.CI_Used_By_ProjName;
document.getElementById('CIMtrek_CI_Used_By_ProjName').value=projectInforamtionMap.CI_Used_By_ProjName;
document.getElementById('projectManager').innerHTML=projectInforamtionMap.CI_Used_By_ProjMgr;
document.getElementById('CIMtrek_CI_Used_By_ProjMgr').value=projectInforamtionMap.CI_Used_By_ProjMgr;
document.getElementById('projectStatus').innerHTML=projectInforamtionMap.CI_Used_By_Status;
document.getElementById('CIMtrek_CI_Used_By_Status').value=projectInforamtionMap.CI_Used_By_Status;
document.getElementById('projectBDM').innerHTML=projectInforamtionMap.CI_Used_By_BDM;
document.getElementById('CIMtrek_CI_Used_By_BDM').value=projectInforamtionMap.CI_Used_By_BDM;
document.getElementById('projectITPlan').innerHTML=projectInforamtionMap.CI_Used_By_IT_Plan;
document.getElementById('CIMtrek_CI_Used_By_IT_Plan').value=projectInforamtionMap.CI_Used_By_IT_Plan;
document.getElementById('projectBucket').innerHTML=projectInforamtionMap.CI_Used_By_IT_Bucket;
document.getElementById('CIMtrek_CI_Used_By_IT_Bucket').value=projectInforamtionMap.CI_Used_By_IT_Bucket;
}
}
});
}
但我在回调期间收到此响应;
The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.
请帮我解决这个问题。
此致。