java - spring mvc页面跳转报404

 迷迷糊糊的Nancy 发布于 2022-10-28 00:56
spring-mvc拦截器


http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    
    
        
    

    
    



    
        
        
    

    
    
        
        
        
        
        
        
    

程序启动后日志:
23-Jul-2016 14:05:35.050 WARNING [http-apr-8080-exec-2] org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/dps/WEB-INF/views/index.jsp] in DispatcherServlet with name 'dps'
23-Jul-2016 14:05:37.841 WARNING [http-apr-8080-exec-7] org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/dps/WEB-INF/views/index.jsp] in DispatcherServlet with name 'dps'

web根目录变成了/dps/WEB-INF而不是/WEB-INF ?????????

3 个回答
  • web-inf 是不可见的,需要内部跳转,你或者把这个jsp提出来,或者自己在jsp上写一个redirect

    2022-10-29 06:53 回答
  • 这是我以前写的一个hello world小demo。https://github.com/HelloListe...

    另外,推荐使用spring boot

    2022-10-29 06:55 回答
  • 在web.xml中把url-pattern改成/就行了

    <servlet-mapping>
        <servlet-name>dps</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
    2022-10-29 06:56 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有