0

私はハッシュマップを返すスプリングコントローラーにこのメソッドを持っています。

@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;
    }

そしてこれは私が使用したjqueryajaxメソッドです:

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.

これを解決するのを手伝ってください。

よろしくお願いします。

4

1 に答える 1

1

これを試して

変化する

 projectInforamtionMap = ds.getProjectInformation(cerNo);

projectInforamtionMap.put("projectInforamtionMap", ds.getProjectInformation(cerNo));

ajax呼び出しで追加

contentType: 'application/json',

dataType : 'json',
于 2013-02-20T12:54:41.927 に答える