为了账号安全,请及时绑定邮箱和手机立即绑定

登录页报404

启动项目控制台不报错  登录页报404https://img1.sycdn.imooc.com//5c0e530c0001cf2b13320751.jpg图片是控制台的

web.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         id="WebApp_ID" version="3.0">


    <!-- 当启动项目后,直接访问项目默认启动的页面 -->

    <filter>
        <filter-name>shiroFilter</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    
    <filter-mapping>
        <filter-name>shiroFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- 加载spring的IOC(业务对象(dao、biz)等对象的创建和管理)和AOP(声明式事务)功能的配置文件,即applicationContext.xml(spring.xml) -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <!-- spring.xml文件的路径配置 -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring/spring.xml</param-value>
    </context-param>


    <servlet>
        <servlet-name>springmvc</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:spring/springmvc.xml</param-value>
        </init-param>
    </servlet>
    <!-- 配置spring-mvc的访问路径 -->
    <servlet-mapping>
        <servlet-name>springmvc</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>


    <filter>
        <filter-name>encodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>encodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>


    <filter>
        <filter-name>HiddenHttpMethodFilter</filter-name>
        <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>HiddenHttpMethodFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

有写错吗

正在回答

6 回答

<property name="loginUrl" value="/login.html" />
要这样写,login.html前面加上/


0 回复 有任何疑惑可以回复我~

https://img1.sycdn.imooc.com//5c46d5d00001afad07420290.jpg

https://img1.sycdn.imooc.com//5c46d5d00001ea5705420329.jpg

https://img1.sycdn.imooc.com//5c46d5d30001e46607310660.jpg

麻烦各位大佬,磅看看! 这是spring.xml spring-mv.xml controller代码 启动Tomcat就报404错误!


0 回复 有任何疑惑可以回复我~
你的问题解决了吗?
0 回复 有任何疑惑可以回复我~

我是把tomcat里该项目的所有代码拷到root下解决了

0 回复 有任何疑惑可以回复我~

请问这个问题是怎么解决的

0 回复 有任何疑惑可以回复我~

有看过spring.xml配置文件吗?有可能是spring.xml中的shiroFilter没有配置好,另外

https://img1.sycdn.imooc.com//5c0f25ec0001994018740480.jpg在ieda中启动服务器后,应该会有图中红框所标位置的,在那里可以看到你的错误信息,如果其中有shiroFilter就代表你是spring.xml中的shiroFilter没有配置好

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

登录页报404

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信