对于那些乐于探索的小伙伴来说,不会仅仅止步于怎么配置web.xml文件,他们更会关注背后的秘密,今天我将
写下我的探索之路
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" metadata-complete="true" version="3.0">
<display-name>xx平台</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:applicationContext.xml,xx.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>/WEB-INF/views/index.jsp</welcome-file>
</welcome-file-list>
</web-app>
相信web开发人员一定对上面的配置很熟悉,这是我节选自web.xml中的一小段配置,下面我将为大家讲述这段配置
背后的秘密,先看一张图:
complexType
"javaee:web-appType"
Namespace:
| |
Content:
|
complex, 3 attributes, 31 elements
|
Defined:
|
globally in web-app_2_5.xsd, see XML source
|
Includes:
|
definitions of 3 attributes and 17 elements
|
Used:
|
at 1 location
|
XML Representation Summary | |||
<... | |||
id |
=
| xsd:ID | |
metadata-complete |
=
| xsd:boolean | |
version |
=
| "2.5" | |
> | |||
</...> |
Content Elements (31):
All Direct / Indirect Based Elements (1):
通过上面的数据,相信大家应该明白web.xml可以按照文章开头配置的原因了吧。
如果还想了解context-param、error-page等一些配置的由来,可以点开具体的项:
比如javaee:error-page