5.15. J2EE Elements

This section describes the web.xml elements that are used for Web applications that are part of a J2EE environment. I’ll provide a brief summary here; for details, see Chapter 5 of the Java 2 Platform Enterprise Edition version 1.3 specification at http://java.sun.com/j2ee/j2ee-1_3-fr-spec.pdf.

distributable

The distributable element indicates that the Web application is programmed in such a way that servers that support clustering can safely distribute the Web application across multiple servers. For example, a distributable application must use only Serializable objects as attributes of its HttpSession objects and must avoid the use of instance variables (fields) for implementing persistence. The distributable element appears directly after the description element (Section 5.11) and contains no subelements or data—it is simply a flag (as below).

<distributable /> 

resource-env-ref

The resource-env-ref element declares an administered object associated with a resource. It consists of an optional description element, a resource-env-ref-name element (a JNDI name relative to the java:comp/env context), and a resource-env-type element (the fully qualified class designating the type of the resource), as below.

<resource-env-ref> 
  <resource-env-ref-name> 
    jms/StockQueue 
  </resource-env-ref-name> 
  <resource-env-ref-type> 
    javax.jms.Queue 
  </resource-env-ref-type> 
</resource-env-ref> 

resource-ref

The resource-ref element declares an external resource used with a resource factory. It consists of an optional description element, a res-ref-name element (the resource manager connection-factory reference name), a res-type element (the fully qualified class name of the factory type), a res-auth element (the type of authentication used— Application or Container), and an optional res-sharing-scope element (a specification of the shareability of connections obtained from the resource— Shareable or Unshareable). Here is an example.

<resource-ref> 
  <res-ref-name>jdbc/EmployeeAppDB</res-ref-name> 
  <res-type>javax.sql.DataSource</res-type> 
  <res-auth>Container</res-auth> 
  <res-sharing-scope>Shareable</res-sharing-scope 
</resource-ref> 

env-entry

The env-entry element declares the Web application’s environment entry. It consists of an optional description element, an env-entry-name element (a JNDI name relative to the java:comp/env context), an env-entry-value element (the entry value), and an env-entry-type element (the fully qualified class name of a type in the java.lang package— java.lang.Boolean, java.lang.String, etc.). Here is an example.

<env-entry> 
  <env-entry-name>minAmount</env-entry-name> 
  <env-entry-value>100.00</env-entry-value> 
  <env-entry-type>java.lang.Double</env-entry-type> 
</env-entry> 

ejb-ref

The ejb-ref element declares a reference to the home of an enterprise bean. It consists of an optional description element, an ejb-ref-name element (the name of the EJB reference relative to java:comp/env), an ejb-ref-type element (the type of the bean— Entity or Session), a home element (the fully qualified name of the bean’s home interface), a remote element (the fully qualified name of the bean’s remote interface), and an optional ejb-link element (the name of another bean to which the current bean is linked).

ejb-local-ref

The ejb-local-ref element declares a reference to the local home of an enterprise bean. It has the same attributes and is used in the same way as the ejb-ref element, with the exception that local-home is used in place of home.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.223.190