define the properties of a resource in/WEB-INF/Web. xml. When you use JNDI to find the and elements, these features are returned. You must also define resource parameters for the same resource name. These parameters are used to configure the attributes of the object factory and the object factory.
for example, Web. xml:
|
|
|
|
<Resource-ref> <description> employees database for HR applications </description> <res-ref-Name> JDBC/employeedb </RES-ref-Name> <res-ref- type> javax. SQL. datasource </RES-ref-type> <res-auth> container </RES-auth> </resource-ref> <resource-env-ref -Name> JMS/stockqueue </resource-env-ref-Name> <resource-env-type> javax. JMS. queue </resource-env-ref-type> </resource-env-ref> |
|
|
|
|
The valid attributes of the <resource-ref>/<resource-env-ref> element are as follows:
Attribute |
Description |
Res-auth |
Web ApplicationCodeThe user signs on to the corresponding resource mananger, or the container represents the web application sign on to the resource manager. The value of this attribute must be application or container. If <resource-ref> is used in the Web application deployment descriptor, this attribute is required. If <resource-env-ref> is used, this attribute is optional. |
Description |
Resource text description (optional) |