I am building a web app in spring MVC.

我正在Spring MVC中构建一个Web应用程序。

I want to retrieve List of patient (collection) using Ajax. But it throws me error of 406 not acceptable

我想使用Ajax检索患者列表(集合)。但它让我错误406不可接受

Jsp File

$(document).ready(function () {
                    $.ajax({
                        url: 'searchPatient',
                        //data: "uhid=" + $("#uhid").val() + "&type=" + $("#type").val(),
                        contentType: 'application/json',
                        dataType: 'json',
                        success: function (data) {
                            alert(data);
                        }
                    });
                });

** Controller File

**控制器文件

@RequestMapping("/searchPatient")
    public @ResponseBody List<String> getPatient() 
    {
             List<String> s = new ArrayList<String>();
        s.add("hello");
        return s;
    }

Console View

How can I solve this error?

我该如何解决这个错误?

2 个解决方案

#1


0

your request URI is http://…/HMIS/searchPatient, so make sure your DispatcherServlet is mapped to /HMIS/* or it's existed in your controller @RequestMapping

您的请求URI是http:// ... / HMIS / searchPatient,因此请确保您的DispatcherServlet映射到/ HMIS / *或它存在于您的控制器@RequestMapping中

更多相关文章

  1. 当我运行.jar时,在java.library中会得到一个“No lwjgl”。路线”
  2. 导入证书后的Java Keytool错误,“Keytool error: Java .io。FileN
  3. Cassandra Java驱动程序错误 - 所有主机尝试查询失败连接已关闭
  4. 线程“main”中的异常java.lang.RuntimeException:无法编译的源代
  5. java httpclient访问某些网页报403错误
  6. Java:IntelliJ想法生成的代码错误地为所有Class名称添加了其包名
  7. “不是抽象的,也不重写抽象的方法”错误

随机推荐

  1. 毕业设计-基于深度神经网络的语音关键词
  2. FieldErro:无法将关键字'date_added'解析
  3. Python 25 Django跨域请求
  4. pytorch中tensor数据和numpy数据转换中注
  5. Python机器学习之Logistic回归
  6. 【懒懒的Tensorflow学习笔记三之搭建简单
  7. 求助!为什么我连python的hello word都写不
  8. 【爬虫初探】新浪微博搜索爬虫实现
  9. KNN(K近邻分类器)Python3实现
  10. Python 浅拷贝和深拷贝使用例子