J2EE deployment files(web.xml)
发表于:2007-07-04来源:作者:点击数:
标签:
web-app This file contains the configuration for a web-application. icon The icon element contains a small-icon and a large-icon element which specify the location within the web application for a small and large image used to represent the
<web-app>
This file contains the configuration for a web-application.
<icon>
The icon element contains a small-icon and a large-icon element which specify the location within the web application for a small and large image used to represent the web application in a GUI tool.
<small-icon>path/to/icon.gif</small-icon>
The small-icon element contains the location within the web application of a file containing a small (16x16 pixel) icon image. The image must be either GIF or JPEG format and the filename must end with the extension of ".gif" or ".jpg".
<large-icon>path/to/icon.gif</large-icon>
The large-icon element contains the location within the web application of a file containing a large (32x32 pixel) icon image. The image must be either GIF or JPEG format and the filename must end with the extension of ".gif" or ".jpg".
<display-name>A friendly name</display-name>
A friendly name that describes this unit.
<description>The description</description>
A short description, use etc.
<distributable />
The distributable element, by its presence in a web application deployment descriptor, indicates that this web application is programmed appropriately to be deployed into a distributed servlet container.
<context-param>
The context-param element contains the declaration of a web application''s servlet context initialization parameters. There are two special kinds of initialization parameters for the optional cases where the parameter is used to obtain the JNDI name of an EJB or a data source for a subsequent look up. These are indicated by an context-param element together with an a
clearcase/" target="_blank" >ccompanying ejb-ref or resource-ref element with matching name.
<param-name>theName</param-name>
The name of the configuration parameter.
<param-value>theValue</param-value>
The value of the configuration parameter.
<servlet>
The servlet element contains the declarative data of a servlet. If a jsp-file is specified and the load-on-startup element is present, then the JSP should be precompiled and loaded.
<icon>
The icon element contains a small-icon and a large-icon element which specify the location within the web application for a small and large image used to represent the web application in a GUI tool.
<small-icon>path/to/icon.gif</small-icon>
The small-icon element contains the location within the web application of a file containing a small (16x16 pixel) icon image. The image must be either GIF or JPEG format and the filename must end with the extension of ".gif" or ".jpg".
<large-icon>path/to/icon.gif</large-icon>
The large-icon element contains the location within the web application of a file containing a large (32x32 pixel) icon image. The image must be either GIF or JPEG format and the filename must end with the extension of ".gif" or ".jpg".
<servlet-name>servletname</servlet-name>
The canonical name of the servlet.
<display-name>A friendly name</display-name>
A friendly name that describes this unit.
<description>The description</description>
A short description, use etc.
<servlet-class>com.company.servlet.DummyServlet</servlet-class>
The class name of a servlet.
<jsp-file>jsp/file/name.jsp</jsp-file>
The path to a JSP file within the web application.
<init-param>
Contains a name/value pair initialization param.
<param-name>theName</param-name>
The name of the configuration parameter.
<param-value>theValue</param-value>
The value of the configuration parameter.
<load-on-startup>priorityNumber</load-on-startup>
Indicates that this servlet should be loaded on startup. The optional contents of these element must be an integer indicating the order in which the servlet should be loaded.
<security-role-ref>
The security-role-ref element contains the declaration of a security role reference in the servlet''s code. The contents of the role-name element is that of the String used in the servlet code to specify a role. The role-link element specifies that this coded role should be linked to a role described by the security-role element.
<description>The description</description>
A short description, use etc.
<role-name>myRole</role-name>
Defines a role name that the developer can use. The deployer maps a set of users and groups to the role name at deployment time.
<role-link>realname</role-link>
The role-link element is used to link a security role reference to a defined security role. The role-link element must contain the name of one of the security roles defined in the security-role elements.
<servlet-mapping>
Defines a mapping between a servlet and a url pattern.
<servlet-name>servletname</servlet-name>
The canonical name of the servlet.
<url-pattern>/*.thePattern</url-pattern>
The url pattern of the mapping.
<session-config>
Defines the session parameters for this web application.
<session-timeout>session-timeout</session-timeout>
Defines the default session timeout interval for all sessions created in this web application. The default units are measured in minutes.
<mime-mapping>
Defines a mapping between and extension and a mime type.
<extension>.txt</extension>
An extension. example: ".txt".
<mime-type>text/plain</mime-type>
A defined mime type. example: "text/plain".
<welcome-file-list>
An ordered list of welcome files.
<welcome-file>index.html</welcome-file>
A welcome file, this file will be served to the user for incoming requests without a file specified (specifying a directory) if it exists. Examples are: index.html, default.jsp, other.file.
<error-page>
Contains a mapping between an error code or exception type to the path of a resource in the web application.
<error-code>theErrorCodeNumber</error-code>
The HTTP error code, ex: 404.
<exception-type>java.exception.TypeOfException</exception-type>
A Java exception type.
<location>path/to/resource</location>
The location of the resource in the web application.
<resource-ref>
The optional resource-ref element contains a declaration of a Web Application''s reference to an external resource. An context-param with the same name must be present whose value will be the JNDI data source. The context-param''s value may be specified at deployment time.
<description>The description</description>
A short description, use etc.
<res-ref-name>theContextParam</res-ref-name>
Specifies the name of the resource factory reference name. This value is the name of the context-param whose value contains the JNDI name of the data source.
<res-type>com.the.TypeOfResource</res-type>
Specifies the (Java class) type of the data source.
<res-auth>CONTAINER|SERVLET</res-auth>
The res-auth element indicates whether the application component code performs resource signon programmatically or whether the container signs onto the resource based on the principle mapping information supplied by the deployer. Must be CONTAINER or SERVLET.
<security-constraint>
Used to associate security constraints with one or more web resource collections.
<web-resource-collection>
Used to identify a subset of the resources and HTTP methods on those resources within a web application to which a security constraint applies.
<web-resource-name>The resource name</web-resource-name>
The name of this web resource collection.
<description>The description</description>
A short description, use etc.
<url-pattern>/*.thePattern</url-pattern>
The url pattern of the mapping.
<http-method>METHOD</http-method>
A HTTP method (GET | POST |...).
<auth-constraint>
Indicates the user roles that should be permitted access to this resource collection as well as the authorization method to be used.
<description>The description</description>
A short description, use etc.
<role-name>myRole</role-name>
Defines a role name that the developer can use. The deployer maps a set of users and groups to the role name at deployment time.
<user-data-constraint>
Used to indicate how data communicated between the client and container should be protected.
<description>The description</description>
A short description, use etc.
<transport-guar
antee>NONE/INTEGRAL/CONFIDENTIAL</transport-guarantee>
The transport-guarantee element specifies that the communication between client and server should be NONE, INTEGRAL, or CONFIDENTIAL.
<login-config>
The login-config element is used to configure the authentication method that should be used, the realm name that should be used for this application, and the attributes that are needed by the form login mechanism.
<auth-method>BASIC/DIGEST/FORM/CLIENT-CERT</auth-method>
The auth-method element is used to configure the authentication mechanism for the web application. As a prerequisite to gaining access to any web resources which are protected by an authorization constraint, a user must have authenticated using the configured mechanism. Legal values for this element are "BASIC", "DIGEST", "FORM", or "CLIENT-CERT".
<realm-name>Name Of Realm</realm-name>
The realm name element specifies the realm name to use in HTTP Basic authorization.
<form-login-config>
The form-login-config element specifies the login and error pages that should be used in form based login. If form based authentication is not used, these elements are ignored.
<form-login-page>path/to/loginpage.jsp</form-login-page>
Defines the location in the web app where the page that is used for login can be found.
<form-error-page>path/to/errorpage.jsp</form-error-page>
Defines the location in the web app where the error page that is displayed when login is not successful can be found.
<security-role>
The security-role element contains the declaration of a security role which is used in the security-constraints placed on the web application.
<description>The description</description>
A short description, use etc.
<role-name>myRole</role-name>
Defines a role name that the developer can use. The deployer maps a set of users and groups to the role name at deployment time.
<env-entry>
The env-entry element contains the declaration of an application''s environment entry. This element is required to be honored on in J2EE compliant servlet containers.
<description>The description</description>
A short description, use etc.
<env-entry-name>nameOfEntry</env-entry-name>
The env-entry-name contains the name of an application''s environment entry.
<env-entry-value>value</env-entry-value>
The env-entry-value element contains the value of an application''s environment entry.
<env-entry-type>java.lang.String</env-entry-type>
The env-entry-type element contains the fully qualified Java type of the environment entry value that is expected by the application code. The following are the legal values of env-entry-type: java.lang.Boolean, java.lang.String, java.lang.Integer, java.lang.Double, java.lang.Float.
<ejb-ref>
Used in conjunction with a matching context-param of the same name to indicate that this parameter will be used to obtain the JNDI name of an EJB.
<description>The description</description>
A short description, use etc.
<ejb-ref-name>nameOfEJB</ejb-ref-name>
Contains the name of an EJB reference. This name must match an context-param name.
<ejb-ref-type>com.type.OfEJBBean</ejb-ref-type>
Contains the expected java class type of the referenced EJB.
<home>com.type.OfEJBHome</home>
Contains the fully qualified name of the EJB''s home interface.
<remote>com.type.OfEJB</remote>
Contains the fully qualified name of the EJB''s remote interface.
<ejb-link>nameOfEJB</ejb-link>
Used in the ejb-ref element to specify that an EJB reference is linked to an EJB in an encompassing J2EE application package. The value of the ejb-link element must be the ejb-name of and EJB in the J2EE application package.
<taglib>
Defines a taglib name in order to simplify the definition inside JSP-pages.
<taglib-uri>myTags</taglib-uri>
The uri as defined in the taglib directive in the JSP-pages.
<taglib-location>/WEB-INF/lib/mytags.jar</taglib-location>
The location of the library or a standalone TLD (relative or absolute URL).
原文转自:http://www.ltesting.net