<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    jasmine214--love

    只有當你的內心總是充滿快樂、美好的愿望和寧靜時,你才能擁有強壯的體魄和明朗、快樂或者寧靜的面容。
    posts - 731, comments - 60, trackbacks - 0, articles - 0

    ZK + Spring + Hibernate最簡單的例子

    Posted on 2010-07-11 16:25 幻海藍夢 閱讀(1079) 評論(0)  編輯  收藏 所屬分類: Ajax Java-eclipse,svn 、網管--拓撲圖
    ?
    原文:http://chanson.javaeye.com/blog/164786
    1、Spring+Hibernate配置起來很簡單,具體就不細說了,網上多的是。

    2、ZK顯示頁面
    【query.zul】
    <?xml version="1.0" encoding="UTF-8"?>
    <window>
    <button label="查詢"></button>
    <vbox>
    ? <listbox id="testListID" width="800px" rows="5" use="chanson.common.web.ui.ListTestBean">
    ??? <listhead>
    ????? <listheader label="姓名"/>
    ????? <listheader label="性別"/>
    ????? <listheader label="生日"/>
    ????? <listheader label="薪資"/>
    ??? </listhead>
    ??? <listitem value="${each.id}" forEach="${testList}">
    ????? <listcell label="${each.name}"/>
    ????? <listcell label="${each.sex}"/>
    ????? <listcell label="${each.birthday}"/>
    ????? <listcell label="${each.money}"/>
    ??? </listitem>
    ? </listbox>
    </vbox>
    </window>

    《說明》:
    A、<?xml version="1.0" encoding="UTF-8"?>
    這個別忘記了,剛學的時候就是因為它報了不少錯誤。
    B、use="chanson.common.web.ui.ListTestBean"
    這個類就是銜接前后臺的關鍵類。
    C、${*.*}這個是標準的EL寫法。


    3、ListTestBean——最關鍵的銜接類
    public class ListTestBean extends Listbox {

    ??? public void onCreate() {
    ??? ? ITestLogic testLogic = (ITestLogic) SpringFactory
    ? .getBeanFactory().getBean("testLogic");
    ??? ? List testList = testLogic.find("from Test");
    ??????? Iterator it = testList.iterator();
    ??????? while(it.hasNext()) {
    ??????????? Test test = (Test) it.next();
    ??????????? Long id = test.getId();
    ??????????? String name = test.getName();
    ??????????? Integer sex = test.getSex();
    ??????????? Date birthday =test.getBirthday();
    ??????????? Double money = test.getMoney();??????

    ??????????? Listitem listitem = new Listitem();
    ??????????? listitem.setValue(id);
    ??????????? listitem.setParent(this);

    ??????????? Listcell nameCell = new Listcell(name);
    ??????????? Listcell sexCell = new Listcell(sex.toString());
    ??????????? Listcell birthdayCell = new Listcell(birthday.toString());
    ??????????? Listcell moneyCell = new Listcell(money.toString());
    ??????????? nameCell.setParent(listitem);
    ??????????? sexCell.setParent(listitem);
    ??????????? birthdayCell.setParent(listitem);
    ??????????? moneyCell.setParent(listitem);
    ??????? }
    ???? }
    }
    《說明》:
    A、例子是一個簡單的查詢,所以看起來也比較簡單。
    B、該類的作用有點像似servlet,只是省略了頁面跳轉
    C、setter/getter真是麻煩,得找找更簡潔的方法



    【附錄】
    1)、數據庫設計——test表
    CREATE TABLE `test` (
    ? `id` decimal(22,0) NOT NULL default '0',
    ? `name` varchar(100) default NULL,
    ? `sex` int(1) default NULL,
    ? `birthday` datetime default NULL,
    ? `money` decimal(15,4) default NULL,
    ? PRIMARY KEY? (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    2)、其他應該沒什么了吧?
    3)、頁面效果圖
    • 描述: 頁面效果圖
    • 大小: 27.5 KB
    主站蜘蛛池模板: 无码国产精品一区二区免费式芒果| 亚州免费一级毛片| 国产成人精品免费午夜app | 毛片a级毛片免费观看品善网| www.亚洲色图.com| h视频免费高清在线观看| 日日麻批免费40分钟无码| 国内一级一级毛片a免费| 久久精品国产精品亚洲下载| 亚洲成人在线免费观看| 日本一区二区三区免费高清在线| 久久久久久夜精品精品免费啦| 在线永久免费观看黄网站| 亚洲免费精彩视频在线观看| 亚洲AV日韩AV永久无码色欲| 久久永久免费人妻精品| 免费播放特黄特色毛片| 亚洲无人区视频大全| 久久久久女教师免费一区| 我要看免费的毛片| 亚洲狠狠综合久久| 成年免费大片黄在线观看com| 免费电影在线观看网站| 久久青青草原亚洲AV无码麻豆 | 亚洲无砖砖区免费| 9i9精品国产免费久久| 日韩黄色免费观看| 亚洲精品视频专区| baoyu777永久免费视频| 国产免费观看视频| 亚洲娇小性色xxxx| 香蕉免费一区二区三区| 亚洲毛片网址在线观看中文字幕| 国产成人亚洲综合一区| 免费A级毛片无码专区| 日本亚洲国产一区二区三区| 国产精品无码亚洲一区二区三区| 2020久久精品国产免费| 亚洲国产一区二区三区青草影视| 一级做a爱过程免费视| 国产成人免费a在线资源|