Could not resolve view with name '***' in servlet with name 'dispatcher'
今天在开发中遇到了一个问题,控制层使用的是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包的问题。
Could not resolve view with name '***' in servlet with name 'dispatcher'的更多相关文章
- Spring mvc-异常javax.servlet.ServletException: Could not resolve view with name 'xxx' in servlet with name 'spring'
最近使用spring mvc开发项目,遇到一个问题: javax.servlet.ServletException: Could not resolve view with name 'ok' in ...
- javax.servlet.ServletException: Could not resolve view with name‘ XXXX’in servlet with name 'spring'的解决方案-----SKY
出现的异常如下: javax.servlet.ServletException: Could not resolve view with name '{"msg":"成功 ...
- javax.servlet.ServletException: Could not resolve view with name 'order/list' in servlet with name 'dispatcherServlet'
javax.servlet.ServletException: Could not resolve view with name 'order/list' in servlet with name ' ...
- springMVC+freemarker中Could not resolve view with name... 问题解决
用到springMVC+freemarker,自己在做demo过程中报: 严重: Servlet.service() for servlet springmvc threw exception jav ...
- 深入浅出Java MVC(Model View Controller) ---- (JSP + servlet + javabean实例)
在DRP中终于接触到了MVC,感触是确实这样的架构系统灵活性不少,现在感触最深的就是使用tomcat作为服务器发布比IIS好多了,起码发布很简单,使用起来方便. 首先来简单的学习一下MVC的基础知识, ...
- java.lang.IllegalArgumentException: Failed to register servlet with name 'dispatcher'.Check if there is another servlet registered under the same name
前言 一年前接手了一个项目,项目始终无法运行,不管咋样,都无法处理,最近,在一次尝试中,终于成功处理了. 含义 意思很明显了,注册了一个相同的dispatcher,可是找了很久,没有相同的Contro ...
- Spring MVC 解读——View,ViewResolver(转)
上一篇文章(1)(2)分析了Spring是如何调用和执行控制器方法,以及处理返回结果的,现在我们就分析下Spring如何解析返回的结果生成响应的视图. 一.概念理解 View ---View接口表示一 ...
- freemarker学习 (servlet + freemarker -> Struts2+freemarker -> springMVC+freemarker)
什么是freemarker? freemarker类似于jsp,但不是jsp!怎么说呢?freemarker文件后缀是.ftl,它不像jsp本质是servlet,它将构建模板.解析模板.使用模板分离开 ...
- springMVC源码分析--视图View(一)
之前的博客springMVC源码分析--HttpMessageConverter数据转化(一)中我们已经介绍了数据返回值的处理,在博客springMVC源码分析--ViewResolver视图解析器( ...
随机推荐
- win10 uwp 自定义控件 SplitViewItem
本文主要是因为汉堡菜单里面列出的菜单很多重复的图标和文字,我把它作为控件,因为是随便写,可能存在错误,如果发现了,请和我说或关掉浏览器,请不要发不良言论. 我们使用汉堡菜单,经常需要一个 需要一个图标 ...
- PHP 页面静态化/纯静态化/伪静态化
个人博客迁移至独立博客:https://blog.plcent.com/,欢迎大家访问 概念 PHP静态化分为:纯静态化 和 伪静态化:纯静态化又分为:局部静态化 和 完全静态化 纯静态化:是把PHP ...
- Vue 国际化 vue-i18n 用法详解
vue-i18n 仓库地址:https://github.com/kazupon/vue-i18n 兼容性: 支持 Vue.js 2.x 以上版本 安装方法:(此处只演示 npm) npm insta ...
- LeetCode 581. Shortest Unsorted Continuous Subarray (最短无序连续子数组)
Given an integer array, you need to find one continuous subarray that if you only sort this subarray ...
- Mybatis报错:Parameter 'list' not found. Available parameters are [groupList, param1]
GroupDao.java 里面定义的方法: void batchInsertLog(@Param("groupList") List<MktPromotionIntegra ...
- idea配置jetty服务器,通过mvn实现
今天想试试除了tomcat之外的另一个服务器jetty的使用: 关于项目在tomcat中的启动大概有多种,尤其是在本地环境下,ide关于tomcat的优化做的很好,但是在idea上面部署tomcat总 ...
- Supervised Learning and Unsupervised Learning
Supervised Learning In supervised learning, we are given a data set and already know what our correc ...
- Lua 5.3 迭代器的简单示例
Lua 5.3 迭代器的简单示例 创建"closure"模式的"iterator" function allowrds() local line = io.re ...
- trait与policy模板技术
trait与policy模板技术 我们知道,类有属性(即数据)和操作两个方面.同样模板也有自己的属性(特别是模板参数类型的一些具体特征,即trait)和算法策略(policy,即模板内部的操作逻辑). ...
- C++ 随机生成一个(0,1)之间的小数
double p; ]; memset(s,,sizeof(s)); s[]='; s[]='.'; ;i<;i++) { s[i]=rand()%+'; } p=atof(s); cout & ...