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存活时间,默认页面,错误页面

  • 相关阅读:
    ubuntu配置jdk和tomcat+部署java项目[最佳实践]
    jQuery TreeGrid
    关于json的一些误解
    jQuery2.0.3源码分析-1(持续更新中......)
    webstrom一些常用快捷键
    js插件-Map插件
    webstorm-删除项目
    随笔-20131209
    软件开发模式对比(瀑布、迭代、螺旋、敏捷)
    javascript学习(10)——[知识储备]链式调用
  • 原文地址:https://www.cnblogs.com/sunxun/p/6626730.html
Copyright © 2011-2022 走看看