• 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

    以上是完整工程下载,

  • 相关阅读:
    angularJS
    WebSocket通信协议
    重写ajax方法实现异步请求session过期时跳转登录页面
    npm(cnpm)介绍(安装gulp)
    grunt安装与配置
    前端学习之jquery
    前端基础之CSS
    前端基础html
    激活
    socket 网络通信(基于tcp协议)以及粘包解决方案
  • 原文地址:https://www.cnblogs.com/2018/p/2154452.html
Copyright © 2020-2023  润新知