java learnging

一块探讨JAVA的奥妙吧
posts - 34, comments - 27, trackbacks - 0, articles - 22

JSP中web.xml文件说明

Posted on 2005-03-04 00:03 bigseal 阅读(1051) 评论(0)  编辑  收藏
web.xml文件的格式是在Servlet的规格说明书中定义的,所以这个文件格式可以用在任何与servlet相容(servlet-conforming )的Java servlet container。在Tomcat有两个地方用到这个文件:$CATALINA_BASE/conf 文件夹和每个web应用程序。Tomcat每次配置一个应用程序(deploys an application )(在启动或当应用程序载入的时候)时读全局conf/web.xml,接着是应用程序中的WEB-INF/web.xml 。正如你所期望的conf/web.xml 文件中的设置会应用的所有的应用程序,而当前应用程序的WEB-INF/web.xml 仅仅应用到当前的应用程序。

这个XML配置描述的根元素是
web-app,这是顶层的元素,并且该文件元素必须按照下表的顺序。这里没有必需的元素,但最好应该有display-name来标识。
Child elements of web-app

Element

Quantity allowed

Meaning

icon

0 or 1

A display file, for use in GUI administration tools

display-name

0 or 1

Short name, for use in GUI admin tools

description

0 or 1

Longer description

distributable

0 or 1

Whether the web application can be load-balanced, i.e., distributed to multiple servers

context-param

0 or more

Parameters to be made available to all servlets

filter

0 or more

Provides a general-purpose servlet-based filtering mechanism

filter-mapping

0 or more

Maps the invocation of a filter to either a servlet name or a URL pattern

listener

0 or more

Context or session Listener classes

servlet

0 or more

Short name, class name, and options for a servlet

servlet-mapping

0 or more

Specifies any nondefault URL for a servlet

session-config

0 or 1

Specifies session configuration (only session timeout in present version of specification)

mime-mapping

0 or more

MIME types for files on server

welcome-file- list

0 or 1

Alternate default page in directories

error-page

0 or more

Alternate error page by HTTP error code

taglib

0 or more

Tag library; see the section on the taglib element, later in this chapter

resource-env-ref

0 or more

Reference to "administered objects," such as JMS queues

resource-ref

0 or more

Reference to JNDI factory for objects such as SQL DataSources

security- constraint

0 or more

Requires authentication (e.g., for a protected area of a web site)

login-config

0 or 1

Specifies how the login mechanism is to work for a security-constraint

security-role

0 or more

List name of security role, for use with security-constraint

env-entry

0 or more

JNDI lookup of static objects

ejb-ref

0 or more

Reference to EJBs used by servlets

ejb-local-ref

0 or more

Reference to EJB local interfaces used by servlets



只有注册用户登录后才能发表评论。


网站导航: