Some common configurations of web projects

Some common configurations in web.xml of dynamic websites

1. Filter character set:

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

 2. When starting the web container, the configuration information of the ApplicationContext is automatically assembled

<listener>
        <description>spring监听器</description>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

 3. Prevent spring memory overflow listener

<listener>
        <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
    </listener>

 4. Configure the session timeout time in minutes

<session-config>
        <session-timeout>15</session-timeout>
    </session-config>

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326864352&siteId=291194637