• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

load on start-up

 
Srinivasa Kadiyala
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I use more than one <load-on-startup> tag in a web.xml?

Ofcourse for diff servelts mentioned in web.xml

Example:

<servlet>
<servlet-name>Log4JInit</servlet-name>
<servlet-class>com.me.pictures.logging.LogInitServlet</servlet-class>
<init-param>
<param-name>log4j-init-file</param-name>
<param-value>/WEB-INF/classes/resources/log4j.properties</param-alue>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>debug</servlet-name>
<servlet-class>com.me.pictures.debug.DebugServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but you wouldn't want them both to be number 1.
That number determines the order in which the servlets load.
 
Srinivasa Kadiyala
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben....
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although you can legally repeat the same number if the order of load doesn't matter. For example if A and B need to load before C, but the order of A and B is moot, both A and B can be 1, and C can be 2.
 
Srinivasa Kadiyala
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear. Ben and you helped me to understand this funda
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic