SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 94 | Next

Larry Brown, Marty Hall, and Yaakov Chaikin

"Core Servlets and JavaServer Pages, Volume 2"

xml 68
You can have more than one servlet or JSP page configured to load at server startup.
The integer 0 in the load-on-startup??™s element body tells the server that
this servlet should be loaded into memory at server startup before any other servlet
or JSP page. The idea is that the server should load lower numbered servlets or JSP
pages before higher numbered ones. For example, the following servlet entries
(placed within the web-app element in the web.xml file that goes in the WEB-INF
directory of your Web application) would instruct the server to first load and initialize
the SearchServlet, then load and initialize the servlet resulting from the
index.jsp file that is in the Web app??™s results directory.

Search
myPackage.SearchServlet
0


Results
/results/index.jsp
1

If you specify two different servlets with the same load-on-startup number,
the server is free to choose which of the same-numbered servlets is loaded first.
Loading the servlet at startup is not guaranteed if you specify a negative number in
the body of the load-on-startup element.
The load-on-startup feature is also convenient if the init (servlet) or
jspInit (JSP) method takes a long time to execute.


Pages:
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106