zoukankan      html  css  js  c++  java
  • java ssm框架入门(三)正式项目的web.xml配置

    一个正规的上线的web.xml的配置。

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="struts_blank" version="2.4"
        xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    
        <display-name>myWeb Application</display-name>
    
        <filter>
            <filter-name>setCharactor</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>
        </filter>
    
        <filter-mapping>
            <filter-name>setCharactor</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    
        <filter>
            <filter-name>struts2</filter-name>
            <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        </filter>
    
        <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>*.action</url-pattern>
        </filter-mapping>
    
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:applicationContext.xml</param-value>
        </context-param>
    
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
    
        <listener>
            <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
        </listener>
    
        <session-config>
            <session-timeout>30</session-timeout>
        </session-config>
    
        <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
    </web-app>

    1.配置Struts   (filter 过滤器)

    Struts属于过滤器,过滤器却不只Struts的配置。还可以加入自己需要的专属过滤器

    2.配置Spring (listener 监听器)

    Spring 属于监听器,监听器却不只Spring 的配置。还可以加入自己需要的专属监听器

    3.系统参数的配置,比如session存活时间,默认页面,错误页面

  • 相关阅读:
    解决函数内this指向
    .Math 数值对象
    时间函数
    数学中的弧度和角度
    闭包
    在拖拽元素的时候,如果元素的内部加了文字或者图片,拖拽效果会失灵?
    正则
    JS高级-事件对象
    JS高级-事件捕捉
    JS高级-面向对象
  • 原文地址:https://www.cnblogs.com/sunxun/p/6626730.html
Copyright © 2011-2022 走看看