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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.