Environment

Environment properties allow you to specify global read-only data for use by all the JSP pages in the Web application.

Servlets and JSP pages must use JNDI to retrieve environment properties, using the prefix java:comp/env in JNDI lookups. Unlike context initialization properties, environment properties can have datatypes other than java.lang.String.

The deployment descriptor catalogs the environment properties used by your servlets and JSP pages, as well as each property’s Java datatype and default value. You can tailor the values to match a server’s configuration. For example, you might have environment properties to specify the name of a logging file or to tune cache usage.

Table 12-12: Environment properties for a JSP target

Setting

Value

Name

Specifies the JNDI name, relative to the java:comp/env prefix, used in servlet and JSP code to refer to this resource.

Type

Select the Java datatype of the property from the drop-down list box. The specified type must have a constructor that takes a single java.lang.String argument.

Value

The initial or post-deployment value of the property, specified as text that is valid for the type constructor that takes a single java.lang.String argument.

Description

(Optional) A comment to explain how the property is used.