You use the context-param element to declare these system-wide initialization
values. The context-param element should conta in param-name,
param-value, and, optionally, description subelements, as shown here.
emailAddress
gates@oracle.com
InitPage
/InitPage.jsp
Listing 2.11
web.xml (Excerpt showing init params
for JSP pages) (continued)
Chapter 2 ?– Controlling Web Application Behavior with web.xml 64
support-email
blackhole@mycompany.com
Loading Servlets When the Server Starts
Suppose the LoadInitServlet has an init method that reads an initialization
parameter, companyName, and stores it in the ServletContext object. The
doGet method of the LoadInitServlet retrieves companyName from the ServletContext
and displays it to the client. After the LoadInitServlet has been
invoked at least once, two different JSP pages, ShowIni tLoaded1.jsp and
ShowInitLoaded2. jsp, are invoked with ${companyName} somewhere on both
pages. The JSP pages will retrieve the previously stored companyName from the
ServletContext and display it to the client. In this case, everything works as we
wou ld expect i t to.
Pages:
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102