execute priority ServletContextEvent handler and static block

39 views
Skip to first unread message

Leung

unread,
Dec 31, 2012, 1:55:56 AM12/31/12
to google-we...@googlegroups.com
Hi

As I recognized from my web application, static block has higher execute priority. So, what should be put in static block, and what should be put in ServletContextEvent Handler.

Thanks

Benjamin Possolo

unread,
Dec 31, 2012, 4:59:38 AM12/31/12
to google-we...@googlegroups.com, Leung
do not put code in a static block in your servlet context listener.
the context initialized method is guaranteed to be called exactly once for a servlet context listener before any of your servlets are initialized

Leung

unread,
Dec 31, 2012, 1:47:32 PM12/31/12
to google-we...@googlegroups.com
Thank you for your reply.
Then what should be put in the servlet context listener and what should be put in the static block?
Reply all
Reply to author
Forward
0 new messages