2.7. An Example Using Initialization Parameters

Listing 2.8 shows a servlet that reads the message and repeats initialization parameters when initialized. Figure 2-5 shows the result when message is Shibboleth, repeats is 5, and the servlet is registered under the name ShowMsg. Remember that, although servlets read init parameters in a standard way, developers set init parameters in a server-specific manner. Please refer to your server documentation for authoritative details. Listing 2.9 shows the configuration file used with Tomcat to obtain the result of Figure 2-5, Listing 2.10 shows the configuration file used with the JSWDK, and Figures 2-6 and 2-7 show how to set the parameters interactively with the Java Web Server. The result is identical ...

Get Core Servlets and JavaServer Pages™ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.