前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >深度解读web.xml

深度解读web.xml

作者头像
johnhuster的分享
发布2022-03-28 21:04:39
发布2022-03-28 21:04:39
20900
代码可运行
举报
文章被收录于专栏:johnhusterjohnhuster
运行总次数:0
代码可运行

对于那些乐于探索的小伙伴来说,不会仅仅止步于怎么配置web.xml文件,他们更会关注背后的秘密,今天我将

写下我的探索之路

代码语言:javascript
代码运行次数:0
复制
<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:

Includes:

definitions of 3 attributes and 17 elements

Used:

javaee:context-param (type javaee:param-valueType ), javaee:description (type javaee:descriptionType ), javaee:display-name (type javaee:display-nameType ), javaee:distributable (type javaee:emptyType ), javaee:ejb-local-ref (type javaee:ejb-local-refType ), javaee:ejb-ref (type javaee:ejb-refType ), javaee:env-entry (type javaee:env-entryType ), javaee:error-page (type javaee:error-pageType ), javaee:filter (type javaee:filterType ), javaee:filter-mapping (type javaee:filter-mappingType ), javaee:icon (type javaee:iconType ), javaee:jsp-config (type javaee:jsp-configType ), javaee:listener (type javaee:listenerType ), javaee:locale-encoding-mapping-list (type javaee:locale-encoding-mapping-listType ), javaee:login-config (type javaee:login-configType ), javaee:message-destination (type javaee:message-destinationType ),

javaee:message-destination-ref (type javaee:message-destination-refType ), javaee:mime-mapping (type javaee:mime-mappingType ), javaee:persistence-context-ref (type javaee:persistence-context-refType ), javaee:persistence-unit-ref (type javaee:persistence-unit-refType ), javaee:post-construct (type javaee:lifecycle-callbackType ), javaee:pre-destroy (type javaee:lifecycle-callbackType ), javaee:resource-env-ref (type javaee:resource-env-refType ), javaee:resource-ref (type javaee:resource-refType ), javaee:security-constraint (type javaee:security-constraintType ), javaee:security-role (type javaee:security-roleType ), javaee:service-ref (type javaee:service-refType ), javaee:servlet (type javaee:servletType ), javaee:servlet-mapping (type javaee:servlet-mappingType ), javaee:session-config (type javaee:session-configType ), javaee:welcome-file-list (type javaee:welcome-file-listType )

All Direct / Indirect Based Elements (1):

javaee:web-app

通过上面的数据,相信大家应该明白web.xml可以按照文章开头配置的原因了吧。

如果还想了解context-param、error-page等一些配置的由来,可以点开具体的项:

比如javaee:error-page

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017/05/12 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档