做web开发的同学,肯定都熟悉web.xml这个文件。比如servlet、filter、Listener等都是在这个文件里配置的。比如你用了struts、spring等框架,都需要在web.xml中进行配置。我们来看一个web.xml的配置。
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0" id="leopard"> <display-name>example</display-name> <absolute-ordering> <name>leopard_webfragment</name> </absolute-ordering> </web-app>
我擦,擦亮眼睛来看?这是什么配置?好像没有见过!你刚说的servlet、filter、listerner的配置呢?
是的,你没有看错?Leopard的xml文件就是这么简单了。细节被我们隐藏了,隐藏到leopard_webfragment里了。这就是servlet3.0的好处之一。
那么leopard_webfragment里究竞配置了些什么东西呢?
<?xml version="1.0" encoding="UTF-8"?> <web-fragment xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd" version="3.0"> <name>leopard_webfragment</name> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> <error-page> <error-code>500</error-code> <location>/error.do</location> </error-page> <jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <el-ignored>false</el-ignored> <page-encoding>utf-8</page-encoding> </jsp-property-group> </jsp-config> <!-- --> <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:/leopard-web/applicationContext.xml </param-value> </context-param> <context-param> <param-name>contextClass</param-name> <param-value>io.leopard.web.LeopardXmlWebApplicationContext</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>web</servlet-name> <servlet-class>io.leopard.web.mvc.LeopardDispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/web-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>web</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <!-- Character Encoding filter --> <filter> <filter-name>CharacterEncodingFilter</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>CharacterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- 用户信息包装 --> <filter> <filter-name>leopardFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <init-param> <param-name>targetFilterLifecycle</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>leopardFilter</filter-name> <url-pattern>*.do</url-pattern> </filter-mapping> </web-fragment>
你想要的我们都帮你配置了?这就是约定优于配置的好处!
相关推荐
[Ubuntu.Linux.基础视频教程].3.10.Ubuntu.Linux.桌面主题.-.Mac.OS.X.Leopard
Mac.OSX_.Snow_.Leopard.Server.v10.6.3 torrent种子
Git Mac 版本git-1.8.3-intel-universal-snow-leopard.dmg
Mac.OS.X.leopard(VMware.Workstation配置文件)
[最新iPhone,iPod,Mac.OS.X.Leopard系列电子书].Mac.OS.X.Leopard.Pocket.Guide
Mac.OS.X.10.5.Leopard.Visual.QuickStart.Guide.pdf
snow.leopard.10.6.1.10.6.2.intel.amd.made.by.hazard.torrent
Apress.Enterprise.Mac.Security.Mac.OS.X.Snow.Leopard.May.2010.rar
Wrox.Beginning.Mac.OS.X.Snow.Leopard.Programming.Feb.2010.part2.rar
Wrox.Beginning.Mac.OS.X.Snow.Leopard.Programming.Feb.2010.part1.rar
Leopard硬盘安装助手v0.3.exe----PC上快速安装mac系统的工具,十分钟就能走完正常两小时的安装过程,你可以到这里下载Leopard硬盘安装助手。 OSInstall和OSInstall.mpkg----苹果操作系统识别MBR系统的补丁。 OSX86...
This driver has been tested on Xilinx ZCU102 platform with a Leopard LI-IMXISX031MIPI-FMC camera board. The Xilinx's platform runs on Linux with V4l2 support for video capture and image processing. ...
mfs-1.6.27-1.tar.gz 压缩文件, ...Project web site: http://www.moosefs.com/ Installation and using MooseFS: http://www.moosefs.org/reference-guide.html Sourceforge project site with source repository: ...
o-Demonoid.com-o_iDeneb_v1_3_10_5_5_Leopard_OSx86
Mac-OS-X-10[1].4.7-AMD.Intel-(JaS)-ISO-Repack.torrent
NULL 博文链接:https://lindows.iteye.com/blog/672175
Mac OS X Leopard Phrasebook,知道Linux Phrasebook吗?现在有了Leopard Phrasebook!我粗略翻了一下,果然是Phrasebook,几乎没有图的——想想看,一本几乎没有截图的Mac OS X的图书是一本多恐怖的书!而全是文字...
It is known to work with Mac OS X versions 10.6.8 (Snow Leopard) through 10.14 (Mojave – see notes below), and has been tested on a wide variety of phones. Although you should be careful with all ...