-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello ZK warriors.
I´d like to ask if you guys know how to implement data binding using MVC style with ZK 7.
In earlier versions I used to implement like this:
zul´s file:
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="./wndIndex"?>
<window id="wndIndex" apply="IndexComposer">
<textbox id="txtName" value="@{$composer.user.name}" />
</window>
composer´s file:
org.zkoss.zkplus.databind.AnnotateBinder binder
def onCreate_wndIndex(Event event) {
binder = (AnnotateBinder) event.target.getAttribute("binder", true);
}
but in ZK 7 the classes from org.zkoss.zkplus.databind.* are now deprecated.
Which classes should I use now? Does someone have a working example?
Best regards,
Felipe Ribeiro
Thanks for your help Chill.
I´ll try to use this set of classes in org.zkoss.bind package
Unfortunatelly all examples for org.zkoss.bind package, including zk´s demos only shows implementation using MVVM style.
If I come out with something I´ll post here later and if someone archives this goal please feel free to help too =)
Best regards,
Felipe Ribeiro
Mine guess is it this :
org.zkoss.bind.AnnotateBinder
Pitty that they didn't add the new class in comment when they set the @Deprecate
Greetz chill.
Thanks for replying Varun.
But actually my problem is not wiring my zul with my controller.
My base of implementation rely on this example http://emrpms.blogspot.in/2013/01/zk-mvc-crud-with-spring-3-jpa-hibernate_20.html
where Senthil Muthiah implemented a binder with org.zkoss.zkplus.databind.*
but as a said before in ZK 7 all classes from the package org.zkoss.zkplus.databind.* are deprecated
so I want to use another set of classes to archive this same result
Best regards,
Felipe Ribeiro
Hi Felipe Ribeiro,
Here I'll rewrite the above code in MVC Style...
In Zul page:
<window id="wndIndex" apply="packageName.JavaClassname">
<textbox id="txtName" />
</window>
In Java Class:
public class JavaClassName extends GenericForwardComposer // ! IMPORTANT
{
Window wndIndex;
Textbox txtName;
public void doAfterCompose(Component comp) throws Exception
{
super.doAfterCompose(comp);
win_parentportal.setAttribute("win_parentportal", this);
someMethodName();
}
public void someMethodName()
{
txtName.setValue("Hello"); OR
txtName.setText("Hello");
}
}
Here extending GenericForwardComposer
is importsnt to bind.
Greetings..
M Varun.
Asked: 2014-02-27 00:16:00 +0800
Seen: 64 times
Last updated: Mar 05 '14