-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3803918
By: lijunrong
I am ajax learner.And I am researching zk now.When I integrate zk 2.0.0 with spring and hibernate,I successed!.But when I use zk 2.0.1,there are some trouble about Initiator.
My code as follows:
package com.potix.zkdemo.test;
import java.util.Collection;
import com.potix.zul.html.Listbox;
import javax.servlet.ServletContext;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.potix.zk.ui.Page;
import com.potix.zk.ui.util.Initiator;
import com.potix.zkdemo.test.HibernateClinic;
public class AllOwners extends Listbox implements Initiator {
public void doInit(Page page,Object Object[]) {
HibernateClinic clinic =getHibernateClinic() ;
page.setVariable("allOwners", clinic.findOwners(""));
}
public void doCatch(Throwable ex) {
}
public void doFinally() {
}
public HibernateClinic getHibernateClinic() {
ApplicationContext ctx=
WebApplicationContextUtils.getRequiredWebApplicationContext(
(ServletContext)this.getDesktop().getWebApp().getNativeContext());
return (HibernateClinic)
ctx.getBean("clinicTarget",HibernateClinic.class);
}
}
the code: this.getDesktop().getWebApp().getNativeContext() can not work.
Anybody can help me? very thanks!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3803937
By: tomyeh
Spec is changed a bit: when doInit is called, page is not associated with a desktop yet. So, invoke Executions.getCurrent().getDesktop().getWebApp()
instead.
See Java Doc:
http://zk1.sourceforge.net/javadoc/2.0.1/zk/com/potix/zk/ui/util/Initiator.html#
doInit(com.potix.zk.ui.Page,%20java.lang.Object[])
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3803976
By: lijunrong
tomyeh:
very thank you. I have resolved this problem according your hints!
Asked: 2006-07-02 01:31:01 +0800
Seen: 289 times
Last updated: Jul 02 '06