HTTP状态500

时间:2015-06-25 12:25:16

标签: java ajax spring

这是我的ajax GET请求:

$.getJSON(..... + '/dashboard/searchDocumentsAndCompanies.do',
                            {q: ul.item.reqQuery, resultType: ul.item.resultType},
                            function (data) {
                                if (data.length == 0) {
                                    data = [
                                        {name: 'No matches found', resultType: 'DOCUMENT', noResults: true}
                                    ];
                                }
                                $.each(data, function (index, document) {
                                    $(".textbox.ui-front li:eq(1)").after(function () {
                                        return $("<li></li>").data("ui-autocomplete-item", ul.item).append(document.name).addClass('ui-menu-item');
                                    });
                                });
                            });

这是我的控制者:

 @ResponseBody
    @RequestMapping(value = "/searchDocumentsAndCompanies.do", method = {RequestMethod.GET })
    public List<SearchResult> searchDocumentsAndCompanies(@RequestParam(value = "q", required = true) String queryString,
                                                          @RequestParam(value = "resultType", required = false) String resultType){
        List<SearchResult> data = null;
        if(SearchResultType.DOCUMENT.getName().equals(resultType)){
            data = searchService.findCompanyAndDocuments(queryString); //test
        }else{
            data = searchService.findCompanyAndDocuments(queryString);
        }
        return data;
    }

当我在此地址上发送请求时,它可以正常工作

  

http://localhost:8081/service/dashboard/searchDocumentsAndCompanies.do?q=test

但是在此地址上,它以 500(内部服务器错误)

进行响应
  

http://localhost:8081/service/dashboard/searchDocumentsAndCompanies.do?q=test&resultType=DOCUMENT

有关我做错的任何建议吗?如果需要更多代码,我将提供。

0 个答案:

没有答案