• 杂记_ssm之web.xml配置


    1.项目加载spring

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

    <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath*:/config/spring/spring*.xml</param-value>
    </context-param>

    2.加载log4j

        <context-param>
            <param-name>log4jConfigLocation</param-name>
            <param-value>WEB-INF/log4j.properties</param-value>
        </context-param>

        <context-param>
            <param-name>log4jRefreshInterval</param-name>
            <param-value>60000</param-value>
        </context-param>

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

     
     3.字符过滤器

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

    4.配置springmvc

    <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*:/config/spring-mvc.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>

    5.配置session失效

    <session-config>
      <session-timeout>600</session-timeout>
    </session-config>

    6.异常处理

    <error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/WEB-INF/views/error/500.jsp</location>
    </error-page>
    <error-page>
    <error-code>500</error-code>
    <location>/WEB-INF/views/error/500.jsp</location>
    </error-page>
    <error-page>
    <error-code>404</error-code>
    <location>/WEB-INF/views/web/error/error404.jsp</location>
    </error-page>

  • 相关阅读:
    cxVerticalGrid赋值是实时更新
    cxGrid类似pagecontrol的效果
    cxgrid属性说明,每次用的时候费时费力查找。
    做一个平均数,合计数的sql查询
    FDMemTable 提示操作速度尤其是循环
    手机号码验证
    取字符串长度
    DELPHI 获取本月 的第一天 和 最后一天
    SQL Server 断开某个数据库所有连接(还原的时候需要)转自用保留
    元宇宙六大核心技术
  • 原文地址:https://www.cnblogs.com/songfahzun/p/6626480.html
Copyright © 2020-2023  润新知