406春天mvc不能接受
16lz
2021-01-22
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;
}
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中
更多相关文章
- 当我运行.jar时,在java.library中会得到一个“No lwjgl”。路线”
- 导入证书后的Java Keytool错误,“Keytool error: Java .io。FileN
- Cassandra Java驱动程序错误 - 所有主机尝试查询失败连接已关闭
- 线程“main”中的异常java.lang.RuntimeException:无法编译的源代
- java httpclient访问某些网页报403错误
- Java:IntelliJ想法生成的代码错误地为所有Class名称添加了其包名
- “不是抽象的,也不重写抽象的方法”错误