-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I implemented the WebAppInit and WebAppCleanup interface.
I expected the WebAppInit to be called when the web application is started (I use Tomcat).
In reality init(WebApp wapp) is not called when the web application is started, but when any zul-page is called the first on that application. It is only a small difference for sure, but if the initialization code e.g. provide services for another application outside, there might be nobody calling a zul-page before the service is used. Is that behavior not a bug? What can I do come around?
I expect the cleanup(WebApp wapp)to be called when the web application is stopped e.g. when I stop Tomcat but it is not. When is cleanup(WebApp wapp) called? What can I do if want to do something before tomcat stops?
Thank you in advance
-peter
It does work for me,
I believe you have missed your listener declaration under zk.xml
Please refer to the following:
Hello Robert,
Yes you are right. cCleanup works.
I just missed to configure my logger for that. However the problem, that the init method is called when a first zul page is loaded and not when the application is started remains.
-Peter
It works for me, too. Your web.xml should have a section something like this:
<servlet> <description>ZK loader for evaluating ZK pages</description> <servlet-name>zkLoader</servlet-name> <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class> <!-- Must. Specifies URI of the update engine (DHtmlUpdateServlet). --> <init-param> <param-name>update-uri</param-name> <param-value>/zkau</param-value> </init-param> <load-on-startup>1</load-on-startup><!-- MUST --> </servlet>
Note that load-on-startup is 1.
/Daryl
Asked: 2008-09-24 08:19:45 +0800
Seen: 444 times
Last updated: Oct 06 '08