model binding

asked 2005-12-10 08:34:27 +0800

admin gravatar image admin
18691 1 10 129
ZK Team

Orignial message at:

By: nobody

Hi. How should I reflect my changes to the view back to the model?

Here is my hello.zul file. I have a controller called testWindow. My model is an attribute of my controller. The model is a simple Person bean with sets and gets for name. The textbox shows the name correctly. However I would like changes to the value in the textbox to be reflected back to the model. How can this be done?

<window id="testWindow" title="Window" border="normal" width="600px"
<textbox id="name" value="${testWindow.person.name}">
<button label="Hello"><attribute


delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2005-12-12 01:26:04 +0800

admin gravatar image admin
18691 1 10 129
ZK Team

Orignial message at:

By: henrichen

Hi! Andrew,

The ZK's programming model is event-driven. i.e. the ZK engine would send(post) events triggered by end users (at browser) to event handlers (at server) written by programmers.

In your case, you should write an event handler to listen to event "onChange"
of the textbox with id == "name".

<textbox id="name" value="${testWindow.person.name}" onChange="testWindow.person.name = self.value"> </textbox>

the "self" in the handler means the "textbox" component itself.

There are at least three ways to register an event handler to an event. Please take a look of the userguide (http://zk1.sourceforge.net/wp/ZK-userguide.pdf).
And we have setup a wikibooks about ZK's How-Tos (http://en.wikibooks.org/wiki/ZK:_How-Tos). Should there were other questions, please check it first. Though it is kind of slim right now :-); we invite you the users to contribute and share your ZK How-Tos.


link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2005-12-10 08:34:27 +0800

Seen: 885 times

Last updated: Dec 12 '05

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More