ZK + Spring + Hibernate最简单的例子
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
分享到:
相关推荐
主要介绍了zk+spring+hibernate的使用方法 早期使用的是 hibernate的配置文件 后来 被改成了 引用注释的方式 老的绑定文件也没有删除,sql下面由数据库文件 导入mysql就可以,不错的教学例子 学习起来很简单
数据库是mysql的 都在压缩文件中了 里面有具体的操作步骤。项目是一个zk+spring+hibernate整合
在自个学习zk和其他两个框架整合的时候,总是找不到合适的整合demo进行参考,希望此次上传能对初学者有用
ZK+Spring+Hibernate jar包名稱
zk+spring+hibernate spring bean的管理全部使用注解,hibernate也全部使用注解
使用zk+spring+hibernate+mysql做的demo,只需要修改下MySQL连接字符串就可以运行。因为容量有点大。分卷压缩了,请下全后解压。
使用zk+spring+hibernate+mysql做的demo,只需要修改下MySQL连接字符串就可以运行。因为容量 有点大。分卷压缩了,请先下载zk+spring+hibernate+mysql demo(),下全后解压。
ZK+Spring+Hibernate项目搭建,最近刚是的,数据库是postgreSQL
zk+spring+hibernate增删改查,整合实例,亲测可用zk+spring+hibernate增删改查,整合实例,亲测可用
在自个学习zk和其他两个框架整合的时候,总是找不到合适的整合demo进行参考,希望此次上传能对初学者有用,能够给你们一个完整的代码,让你们可以直接把项目运行起来,这样对于开发来说是最重要的
ZK Spring hibernate 完美整合
很多zk初学者对zk与spring和hibernate的整合很头疼,在这花了一晚上的时间整了个完整工程包供大家学习参考,所需jar包很大,都抓成图片了,具体看工程说明. 在遇到zk方面的问题可以加qq群:71714290交流。
zk+dubbo+spring本地工程
NULL 博文链接:https://marsvaadin.iteye.com/blog/1391554
Spring+hibernate+ZK例子
此项目简单的搭建出zookeeper和dubbo的环境。并分出接口的服务端和接口的客户端两个小项目,进行接口的测试,此项目只是用于简单理解zk+dubbo的服务提供,不作为正式项目使用。
包含构建spring+springmvc+jpa(hibernate)架构框架的所需文件
J2EE课程设计,读取内存图片,在线修改等特殊功能,ZK+Hibernate框架
SpringBoot+zk+dubbo电商微服务架构.zip SpringBoot+zk+dubbo电商微服务架构.zip SpringBoot+zk+dubbo电商微服务架构.zip SpringBoot+zk+dubbo电商微服务架构.zip SpringBoot+zk+dubbo电商微服务架构.zip