Java AJAX开发系列 - 3, ZK MVC

MVC架构在现在的很多系统中都有使用,ZK中同样也可以使用这种模式,如下是具体的例子:

View

<window id="win" title="ZK Essentials" border="normal" width="250px" apply="demo.zkoss.SampleCtrl">

<listbox id="orderLibox"

model="@{orderArea$composer.orders}" selectedItem="@{selectedX}">

<listhead>

<listheader label="info" />

<listheader label="description" />

<listheader label="Sub Total" />

</listhead>

<listitem self="@{each='order'}" value="@{order}">

<listcell

label="@{order, converter='demo.web.ui.OrderInfoTypeConverter'}" />

<listcell label="@{order.description}" />

<listcell label="@{order.total}" />

</listitem>

</listbox>

<button id="helloBtn" label="Hello"/>

</window>

Controller

package demo.zkoss;

import org.zkoss.zk.ui.util.GenericForwardComposer;

import org.zkoss.zul.Button;

import org.zkoss.zul.Window;

public class SampleCtrl extends GenericForwardComposer {

Window win;

public void onClick$helloBtn(){

Button btn = new Button();

btn.setLabel("World !");

btn.setParent(win);

}

public List<Order> getOrders() {

List<Order> orders = getOrderDAO().findByUser(getCurrentUserId());

return orders;

}

}

Model

Order就是Model对象

 

ZK 5 Essentials 书中例子就包含了这方面的内容:

https://skydrive.live.com/?cid=56b433ad3d1871e3&id=56B433AD3D1871E3%21265

以上是完整工程下载,

 

转载于:https://www.cnblogs.com/2018/archive/2011/09/07/2154452.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值