今天在创建了一个简单的ssm项目时,使用tomcat启动后,通过url访问jsp文件一直报404错误,在内部controller中可以通过快捷键crtl+鼠标左键定位到相应的jsp文件,但是运行后通过url访问不到
The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
通过查看日志发现是前端控制器运行的最后一步发生了问题,再看404的报错链接,
可以发现WEB-INF前多了项目的名称,可能是视图解析器在解析时自动添加了项目名称,所以在配置视图解析器时需要做一些改变,
改之前
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"