O'Reilly logo

Web Technology: Theory and Practice by M. Srinivasan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5.6 EXAMPLE—READ ENVIRONMENT PARAMETERS

There are several environmental parameters that are available to the Servlet. Some of them are set by the programmer and the rest are available in the environment. Take a look at this program which prints out these variables.

First, let us see the parameters. There is something interesting—note the Inititalization Parameters.

The XML listing is shown below (Figure 5.16) for reference. Note the initial parameter set within the <init-param> set of tags (lines 6–9). The initial parameter is defined as name-value pairs; there can be many of them, but in this example there is only one defined (THEME:FORMAL).

 

 

Fig. 5.15 Web.xml configuration including an init parameter

 

 

 

Fig. 5.16 Web.xml file (myEnv) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required