-
Bug
-
Resolution: Fixed
-
Major
-
None
-
None
-
None
As code below in zkjsp 2.1, it works fine before 6.0.2.
jsp file
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://www.zkoss.org/jsp/zul" prefix="z"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>helloMVVM Demo</title> </head> <body> <z:page zscriptLanguage="java"> You should see 'text box' in a textbox and 'label' in a label at the begining <br /> Click 'say hello' button <br /> You should see 'Hello' in the textbox and 'MVVM' in the label <z:window apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('org.zkoss.jspdemo.bean.binding.HelloMVVM')"> <z:textbox value="@load(vm.textboxStr)" /> <z:label value="@load(vm.labelStr)" /> <br /> <z:button label="say hello" onClick="@command('sayHello')" /> </z:window> </z:page> </body> </html>
VM
package org.zkoss.jspdemo.bean.binding; import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.NotifyChange; public class HelloMVVM { private String _textboxStr = "text box"; private String _labelStr = "label"; public void setTextboxStr (String textboxStr) { _textboxStr = textboxStr; } public String getTextboxStr () { return _textboxStr; } public void setLabelStr (String labelStr) { _labelStr = labelStr; } public String getLabelStr () { return _labelStr; } @Command @NotifyChange({"textboxStr", "labelStr"}) public void sayHello () { _textboxStr = "Hello"; _labelStr = "MVVM"; } }