一个正规的上线的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. 谋哥:《App自推广》开篇之回到远古人类

    [谋哥每天一干货.第六十八篇] 这两天帮谋天团的杨整体验他的App--"闪聊"的内測新版,改版后这款App命名为"美丫",一款致力于打造国内首款专注于女性社交的 ...

  2. PHP - AJAX 与 MySQL

    PHP - AJAX 与 MySQL AJAX 可用来与数据库进行交互式通信. AJAX 数据库实例 下面的实例将演示网页如何通过 AJAX 从数据库读取信息: 本教程使用到的 Websites 表 ...

  3. I/O复用的应用场合

    I/O复用(select.poll)典型使用在下列网络应用场合: (1)当客户处理多个描述字(通常是交互式输入和网络套接口)时,必须使用I/O复用. (2)一个客户同时处理多个套接口是可能的,不过比较 ...

  4. SpringMVC日期类型转换问题处理方法归纳

    前言 我们在SpringMVC开发中,可能遇到比较多的问题就是前台与后 台实体类之间日期转换处理的问题了,说问题也不大,但很多人开发中经常会遇到这个问题,有时很令人头疼,有时间问题暴露的不是很明显,然 ...

  5. Failed to initialize storage module: user 的解决方式

    网上提供了一种解决方法就是在session_start()前把session的存储方式改为files,即加入以下一句代码 if (ini_get('session.save_handler') !== ...

  6. 算法笔记_142:无向图的欧拉回路求解(Java)

    目录 1 问题描述 2 解决方案   1 问题描述 John's trip Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8 ...

  7. Servlet实现文件上传,可多文件上传

    一.Servlet实现文件上传,需要添加第三方提供的jar包 接着把这两个jar包放到 lib文件夹下: 二: 文件上传的表单提交方式必须是POST方式, 编码类型:enctype="mul ...

  8. 查看sqlserver 2008中性能低下的语句

    经常使用这个语句来查看性能低下的sql语句: SELECT creation_time N'语句编译时间' ,last_execution_time N'上次执行时间' ,total_physical ...

  9. excel 根据单元格内容自动调整列宽

      excel 根据单元格内容自动调整列宽 CreateTime--2018年5月28日08:49:40 Author:Marydon 1.情景展示 单元格宽度超过了列宽 2.解决方案 第一步:同时选 ...

  10. OpenCV求取轮廓线

    // Threshold.cpp : Defines the entry point for the console application. // #include "stdafx.h&q ...