Could not resolve view with name '***' in servlet with name 'dispatcher'
来源:互联网 发布:织梦cms二次开发教程 编辑:程序博客网 时间:2024/06/16 19:48
今天在开发中遇到了一个问题,控制层使用的是SpringMVC框架。
@RequestMapping("historyDetail") private String History(ModelMap model,LedMsgTextInfo condition){ LedMsgTextInfo ledMsgTextInfo; Long id = condition.getId(); ledMsgTextInfo = ledMsgTextService.getById(id); List<DeviceLedInfo> ledDeviceList = DeviceLedService.queryLedDeviceList(null); for(DeviceLedInfo ledInfo:ledDeviceList){ String DeviceCode = ledInfo.getDeviceCode(); if(ledMsgTextInfo.getDeviceCode().equals(DeviceCode)){ ledMsgTextInfo.setDeviceName(ledInfo.getDeviceName()); } } model.put("ledDeviceList", ledMsgTextInfo); return "jtyd/historyDetail"; }
在进行页面跳转时,出现了异常:HTTP Status 500 - Could not resolve view with name ‘jtyd/historyDetail’ in servlet with name ‘dispatcher’
查询网上资料后,有两种类型的错误说明,一种是页面跳转,一种是json返回。
- 页面跳转:
出现这种异常可能是由于返回值不对,本例中返回值实际上应该是:jtyd/HistoryDetail。仅仅是一个字母的差别。 - json返回:
出现这种异常可能是因为在配置文件中配置了:
<property name="defaultContentType" value="text/html" />
想要纠正就需要改为:<property name="defaultContentType" value="application/json" />
或者在每一个适配器(请求的方法)上面加上@ResponseBody注解。
个人认为第二种情况出现的错误比较少见,常见的还是第一种情况,即写错了返回值。所以在书写代码的时候一定要注意避免出现书写错误,细心就行。
备注:
关于第二种配置的问题,个人开发过程中还没有尝试在配置文件中添加返回头的配置,都是通过书写@ResponseBody注解来解决异步请求的返回值处理问题的。
遇到一个比较详细的案例:http://blog.csdn.net/abc360200314/article/details/22862727
出的问题是一样的,但是解决方式不同,目前还没有去看jar包的问题。
阅读全文
0 0
- Could not resolve view with name 'sys/menu/user' in servlet with name 'dispatcher'
- Could not resolve view with name '***' in servlet with name 'dispatcher'
- javax.servlet.ServletException: Could not resolve view with name 'ok' in servlet with name 'spring'
- javax.servlet.ServletException: Could not resolve view with name 'xxxxx'in servlet with name 'xxx'
- javax.servlet.ServletException: Could not resolve view with name 'qq' in servlet with name 'WeiXin'
- javax.servlet.ServletException: Could not resolve view with name 'xxx' in servlet with name
- javax.servlet.ServletException: Could not resolve view with name 'xxxxx'in servlet with name 'xxx'
- Could not resolve view with name 'bok.html' in servlet with name 'spring'
- Could not resolve view with name 'ok' in servlet with name 'spring'
- Could not resolve view with name 'pcir/del' in servlet with name 'forum'
- Spring mvc-异常javax.servlet.ServletException: Could not resolve view with name 'xxx' in servlet with
- Could not resolve view with name
- Could not resolve view with name 'xxxxx‘
- javax.servlet.ServletException: Could not resolve view with name 'destination/isOtherExist' in servl
- springMVC+freemarker中Could not resolve view with name... 问题解决
- Spring mvc 4.0+freemarker抛javax.servlet.ServletException: Could not resolve view with name
- Spring 4.0.2 + Apache Tiles 3.0.3 [Could not resolve view with name "xxx"]
- apache [error] (EAI 5)No address associated with hostname: Could not resolve host name
- 教您用数学课件制作工具演示二次函数切线
- python 正则捕获
- CentOS安装openresty或者verynginx时:undefined reference to `pcre_free_study'
- 使用LoRa技术进行智慧城市转型
- 第十二课 tensorflow 使用RNN实现古诗自动生成
- Could not resolve view with name '***' in servlet with name 'dispatcher'
- Android 设置透明状态栏和导航栏
- Java Eclipse的菜单全部变成乱码,如何解决?
- eclipse中java项目的build path详解
- 文件和目录
- xiti66
- uva11413
- DataWindow的数据缓冲区
- UVa11039