Java Ajax Development Series-3, ZK MVC

Source: Internet
Author: User
The MVC Architecture is used in many systems. This mode can also be used in zk. The following is an example: View

<Window id = "win" Title = "zk essenessen" 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 is the model object.

 

The example in ZK 5 essenessencontains the following content:

Https://skydrive.live.com /? Cid = 56b433ad3d1871e3 & id = 56b433ad3d1871e3% 21265

The above is the download of the complete project,

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.