一个正规的上线的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存活时间,默认页面,错误页面

java ssm框架入门(三)正式项目的web.xml配置的更多相关文章

  1. java ssm框架入门(一)面向接口编程

    因为工作上用到spring + strtus2 + mybatis ,所以开始学习下这个框架. 这里用到的是MySQL数据库 首先从web.xml 开始 <?xml version=" ...

  2. 使用 java替换web项目的web.xml

    创建一个接口: package my.web; public interface SpringWeb { void config(); } 实现类: package my; import my.web ...

  3. maven(四):一个基本maven项目的pom.xml配置

    继续之前创建的test项目,一个基本项目的pom.xml文件,通常至少有三个部分 第一部分,项目坐标,信息描述等 <modelVersion>4.0.0</modelVersion& ...

  4. maven web项目的web.xml报错The markup in the document following the root element must be well-formed.

    maven项目里面的web.xml开头约束是这样的 <?xml version="1.0" encoding="UTF-8"?> <web-a ...

  5. Spring mvc项目的web.xml以及注释

    web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp ...

  6. java ssm框架入门(二)添加语言滤器

    使用过滤器是在web.xml中使用filter,以下是码过滤器,过滤所有资源的使用 web.xml <filter> <filter-name>setCharactor< ...

  7. Maven项目的pom.xml配置文件格式初识

    Maven项目 有pom.xml文件的项目就已经是一个maven项目了,但是还没有被maven托管,我们需要将该项目添加为maven项目 <project xmlns="http:// ...

  8. IDEA创建maven项目的web.xml头

    使用IDEA创建maven项目骨架是webapp时,软件自动创建的web.xml文件是2.3版本的,不能使用el表达式,所以可以手动换成4.0的文件头. <?xml version=" ...

  9. Idea创建Maven Web项目的web.xml版本问题

    问题描述:创建Maven Web项目时,选择MavenWebapp模板时,自动生成的web.xml文件版本为1.4,如图所示 如何才能修改为常用的4.0版本的xml文件呢? 这个文件是从Maven仓库 ...

随机推荐

  1. Android触控屏幕Gesture(GestureDetector和SimpleOnGestureListener的使用教程) 分类:Androidandroid实例

    1.当用户触摸屏幕的时候,会产生许多手势,例如down,up,scroll,filing等等,我们知道View类有个View.OnTouchListener内部接口,通过重写他的onTouch(Vie ...

  2. 【算法】Logistic regression (逻辑回归) 概述

    Logistic regression (逻辑回归)是当前业界比较常用的机器学习方法,用于估计某种事物的可能性.比如某用户购买某商品的可能性,某病人患有某种疾病的可能性,以及某广告被用户点击的可能性等 ...

  3. facebook开源的adb 工具,解决adb连不上手机的问题

    一. fb-adb.fb-adb(https://github.com/facebook/fb-adb)

  4. (剑指Offer)面试题48:不能被继承的类

    题目: 写一个不能被继承的类 思路: 1.把构造函数设为私有函数 在C++中子类的构造函数会自动调用父类的构造函数,子类的析构函数也会自动调用父类的构造函数,要想一个类不能被继承,只要把它的构造函数和 ...

  5. html中嵌入flvplayer.swf播放器,播放视频

    只需要改动红色的代码: <object classid='clsid:D27CDB6E-AE6D-11cf-96B8-4445535411111' codebase='http://downlo ...

  6. 静态库与动态库的制作以及程序的动态函数库解析ldd;ldconfig与/etc/ld.so.conf

    静态库的制作步骤: (1)gcc -c mylib.c -o mylib.o (2)ar rc libmylib.a mylib.o 动态库的制作步骤: gcc -shared mylib.c -o ...

  7. 关于SO_REUSEADDR的使用说明~

    参考WINDOWS   网络编程技术         1.   可以对一个端口进行多次绑定,一般这个是不支持使用的:     2.   对于监听套接字,比较特殊.如果你定义了SO_REUSEADDR, ...

  8. PotPlayer 进度条显示缩略图

      PotPlayer设置鼠标放在播放器进度条任意位置显示缩略图 迁移时间--2017年8月9日15:41:27Author:Marydon 右键-->选项(F5)-->点击左侧面板上的“ ...

  9. windows设置文件夹显示缩略图

      windows设置文件夹显示缩略图 CreateTime--2017年7月26日16:32:59Author:Marydon 为什么要显示缩略图? a.显示缩略图后,图片文件能够直接显示内容,不能 ...

  10. js与jQuery方法对比

      javascript与jQuery方法对比jquery对象转dom对象 // 方式一(推荐使用) $("input")[0] // 方式二 $("input" ...