javax.servlet.ServletException: Could not resolve view with name

解析SpringMVC视图异常
本文探讨了SpringMVC+Freemarker框架下遇到的视图解析异常问题,包括视图名称错误、Action返回视图名错误及未正确使用@ResponseBody注解等情况。

   SpringMVC+Freemarker的开发框架中,遇到了这个异常javax.servlet.ServletException: Could not resolve view with name,这个是说视图不能被解析识别,一般是html,jsp的名字写错了,有时候是在Action中返回的视图名写错了,有时候是Action本来是要返回一个json字符串,而忘记在Action加注解 @ResponseBody,导致Action去找视图,这个样就会报异常。

 

14:19:20.764 [http-nio-8080-exec-6] DEBUG org.springframework.web.servlet.DispatcherServlet - GET "/users", parameters={} 14:19:20.770 [http-nio-8080-exec-6] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped to com.example.controller.UserController#listUsers(Model) 14:19:20.807 [http-nio-8080-exec-6] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 14:19:20.814 [http-nio-8080-exec-6] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@176c8a1b] was not registered for synchronization because synchronization is not active 14:19:20.826 [http-nio-8080-exec-6] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. 14:19:20.885 [http-nio-8080-exec-6] INFO com.alibaba.druid.pool.DruidDataSource - {dataSource-1} inited 14:19:21.115 [http-nio-8080-exec-6] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@601494d3] will not be managed by Spring 14:19:21.121 [http-nio-8080-exec-6] DEBUG com.example.mapper.UserMapper.findAll - ==> Preparing: SELECT * FROM user 14:19:21.140 [http-nio-8080-exec-6] DEBUG com.example.mapper.UserMapper.findAll - ==> Parameters: 14:19:21.165 [http-nio-8080-exec-6] DEBUG com.example.mapper.UserMapper.findAll - <== Total: 1 14:19:21.165 [http-nio-8080-exec-6] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@176c8a1b] 14:19:21.174 [http-nio-8080-exec-6] DEBUG org.springframework.web.servlet.DispatcherServlet - Failed to complete request: javax.servlet.ServletException: Could not resolve view with name 'user_list' in servlet with name 'dispatcher'
最新发布
10-25
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值