web.xml中哪一步设置了网站在每一个多小时就会自动跳转到首页?

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


    <!-- Context ConfigLocation -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:spring.xml,classpath:spring-mybatis.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <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>



    <!--CORS跨域请求过滤-->
    <filter>
        <filter-name>CORSFilter</filter-name>
        <filter-class>com.lqb.web.filter.CORSFilter</filter-class>
        <init-param>
            <param-name>allowDomain</param-name>
            <param-value>null,file://</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>CORSFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- 登录校验 -->
    <filter>
        <filter-name>checkLoginFilter</filter-name>
        <filter-class>com.lqb.web.filter.CheckLoginFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>checkLoginFilter</filter-name>
        <url-pattern>/remind/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>checkLoginFilter</filter-name>
        <url-pattern>/authority/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>checkLoginFilter</filter-name>
        <url-pattern>/buildingmanagement/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>checkLoginFilter</filter-name>
        <url-pattern>/resource/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>checkLoginFilter</filter-name>
        <url-pattern>/homepage.html</url-pattern>
    </filter-mapping>
    <!--<filter-mapping>-->
        <!--<filter-name>checkLoginFilter</filter-name>-->
        <!--<url-pattern>/app/contract/*</url-pattern>-->
    <!--</filter-mapping>-->
    <!--<filter-mapping>-->
        <!--<filter-name>checkLoginFilter</filter-name>-->
        <!--<url-pattern>/app/data/*</url-pattern>-->
    <!--</filter-mapping>-->
    <!--<filter-mapping>-->
        <!--<filter-name>checkLoginFilter</filter-name>-->
        <!--<url-pattern>/app/mansion/*</url-pattern>-->
    <!--</filter-mapping>-->
    <!--<filter-mapping>-->
        <!--<filter-name>checkLoginFilter</filter-name>-->
        <!--<url-pattern>/app/permission/*</url-pattern>-->
    <!--</filter-mapping>-->
    <!--<filter-mapping>-->
        <!--<filter-name>checkLoginFilter</filter-name>-->
        <!--<url-pattern>/app/remind/*</url-pattern>-->
    <!--</filter-mapping>-->
    <!--<filter-mapping>-->
        <!--<filter-name>checkLoginFilter</filter-name>-->
        <!--<url-pattern>/app/source/*</url-pattern>-->
    <!--</filter-mapping>-->

    <!--<filter-mapping>-->
        <!--<filter-name>checkLoginFilter</filter-name>-->
        <!--<url-pattern>/app/system/*</url-pattern>-->
    <!--</filter-mapping>-->
    <!--<filter-mapping>-->
        <!--<filter-name>checkLoginFilter</filter-name>-->
        <!--<url-pattern>/app/upload/*</url-pattern>-->
    <!--</filter-mapping>-->
    <!--<filter-mapping>-->
        <!--<filter-name>checkLoginFilter</filter-name>-->
        <!--<url-pattern>/app/user/loginOut</url-pattern>-->
    <!--</filter-mapping>-->
    <!--<filter-mapping>-->
        <!--<filter-name>checkLoginFilter</filter-name>-->
        <!--<url-pattern>/app/user/getUserInfo</url-pattern>-->
    <!--</filter-mapping>-->
    <!--<filter-mapping>-->
        <!--<filter-name>checkLoginFilter</filter-name>-->
        <!--<url-pattern>/app/user/updateUse</url-pattern>-->
    <!--</filter-mapping>-->

    <servlet>
        <servlet-name>springServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath*:/spring*.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>

    </servlet>
    <servlet-mapping>
        <servlet-name>springServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <!--<servlet>-->
        <!--<servlet-name>log4jconfigfile</servlet-name>-->
        <!--<servlet-class>Log4jInitServlet</servlet-class>-->
        <!--<init-param>-->
            <!--<param-name>configfile</param-name>-->
            <!--<param-value>classpath*:/log4j.properties</param-value>-->
        <!--</init-param>-->

        <!--<load-on-startup>1</load-on-startup>-->
    <!--</servlet>-->
    <!--<servlet-mapping>-->
        <!--<servlet-name>log4jconfigfile</servlet-name>-->
        <!--<url-pattern>/app/</url-pattern>-->
    <!--</servlet-mapping>-->

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

    <session-config>
        <session-timeout>3000</session-timeout>
    </session-config>
</web-app>
一只萌萌小番薯
浏览 779回答 3
3回答

郎朗坤

在web.xml没有这种配置,猜测是最后session-config这里的配置使session失效,验证跳转到登陆页

繁星淼淼

优先考虑session超时导致的首页跳转 tomcat的conf/web.xml可以配置,<session-config>标签,一般是30分钟 项目的web.xml里面可以配置<session-config>标签,你给的里面配的是3000,单位是分钟 java代码可以通过session.setMaxInactiveInterval来配置session超时 项目里面代码有相关的过滤拦截,你这里有一个checkLoginFilter,看一下里面有没有做判断优先级上 4>3>2>1
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java