- 浏览: 325599 次
- 性别:
- 来自: 沈阳
文章分类
- 全部博客 (160)
- Hiberate (13)
- struts+spring+hibernate (8)
- tomcat服务器 (3)
- sql server2000数据库 (1)
- JSTL标签 (4)
- 数据库 (1)
- jsp (3)
- mysql (4)
- xml (2)
- 字符串操作 (6)
- js (2)
- 过滤器 (0)
- dwr (2)
- Extjs学习笔记 (12)
- java文件 (2)
- struts错误记录 (2)
- struts经验技巧 (2)
- struts+spring+ibatis (3)
- 学习积累--分页的实现过程 (8)
- 递归 (1)
- 工具使用 (1)
- swfupload批量上传 (1)
- flex+webservice (1)
- 精彩文章分享 (0)
- flex+eclipse开发环境 (1)
- DB2数据库 (2)
- ssh+pager taglib分页实现 (2)
- java (0)
- java 异常 (2)
- mylipse6.5 环境内存溢出 (2)
- java 操作word文件 (1)
- 异常整理 (1)
- sql server 2005使用心得 (3)
- jdbc数据库封装 (1)
- javaMail 收发邮件 (1)
- 数据库设计 (1)
- jfreechart图表研究 (1)
- ibatis 学习积累 (1)
- 强制固定表格 (1)
- struts+hibernate (1)
- 分页标签的使用 (1)
- 基于mediawiki的安装心得 (1)
- mediawiki (0)
- Sturs2+Spring2.5+Hibernate3.5+compass 整合 (1)
- RestEasy (3)
- Date 日期公共类整理 (1)
- Excel (8)
- JAVA生成PDF文件 (1)
- Struts1.2+Jquery+Hibernate (1)
- 数据库连接池配置 (0)
- ANT 学习实例 (2)
- 英语学习总结 (1)
- Google动画脚本收藏 (1)
- 20111012 Google动画脚本 (0)
- JQUERY资料整理 (2)
- java图片处理 (1)
- Map集合 (1)
- JAVA 整理AD资料 (2)
- JAVA热启动 (3)
- JAVA操作XML (1)
- TOMCAT6连接池配置问题解决方案 (1)
- JAVA调用DLL学习 (1)
- JAVA移动应用(发送手机短信) (2)
- JAVA发送手机短信 (1)
- iReport报表使用心得 (2)
- 解决Ireport生成PDF报表中文乱码问题 (1)
- iReport使用 (1)
- 全文搜索 compass (1)
- SVN管理 (1)
- Myeclipse8.5 工具编译 (1)
- ibm appscan 扫描问题汇总解决 (1)
- Rose建模设计工具 (1)
- oracle (1)
- MyEclipse8.5注册码(8.6也可以) (0)
- oracle job定时触发执行 (1)
- java Excel导出公用类 (1)
- Highcharts图表 (1)
- excel打包成zip文件,并且提供加密功能 (0)
- excel打包成zip文件 (1)
- 并且提供加密功能 (1)
- vue学习 (1)
- WebStorm使用 (1)
最新评论
-
ahkoun:
楼主棒棒哒,下载后可以直接运行
使用 RestEasy 和 Apache Tomcat 构建 RESTful Web 服务 -
520920:
真的可以了,很棒!
java.lang.Exception: DEBUG -- CLOSE BY CLIENT STACK TRACE -
Yellow013:
不错的例子。
使用 RestEasy 和 Apache Tomcat 构建 RESTful Web 服务 -
huahoucun:
passwd = null; env.put(Context. ...
JAVA 实现AD验证 -
来迟了:
http://www.smschinese.cn/api.sh ...
JAVA发送手机短信
package mrmwq;
// 导入相关包文件
import java.util.List;
// 导入hibernate2资源包文件
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Query;
import net.sf.hibernate.Session;
public class PaginationInfo {
private Session session; // session对象
private String hql = "";
private int totalCount = 0;
private int pageCount = 3; // 每页的显示的数据项
private boolean hasPreviousPage = false; // 上一页
private boolean hasNextPage = false; // 下一页
private int totalPageNum = 1;
private int currentPageNum = 1;
// 私有的构造函数
public PaginationInfo() {
}
// 初始化分页信息
public void init(Session session, String hql, int pageCount) throws Exception {
this.session = session;
this.hql = hql;
this.pageCount = pageCount;
totalCount = ((Integer) session.createQuery("select count(*)" + hql).
uniqueResult()).intValue();
if (this.totalCount % this.pageCount == 0) {
this.totalPageNum = this.totalCount / this.pageCount;
} else {
this.totalPageNum = this.totalCount / this.pageCount + 1;
}
if (this.totalPageNum > 1) {
this.hasNextPage = true;
}
}
// 获得前一页信息
public List getPreviousPage(Session session) throws HibernateException {
this.session = session;
if (this.getCurrentPageNum() > 1) {
this.currentPageNum = this.currentPageNum - 1;
if (this.currentPageNum > 1) {
this.hasPreviousPage = true;
this.hasNextPage = true;
} else {
this.hasPreviousPage = false;
this.hasNextPage = true;
}
}
return this.getPageMessage();
}
// 获得当前页信息
public List getCurrentPage(Session session) throws Exception {
this.session = session;
return this.getPageMessage();
}
// 获得下一页信息
public List getNextPage(Session session) throws Exception {
this.session = session;
if (this.getCurrentPageNum() < this.totalPageNum) {
this.currentPageNum = this.currentPageNum + 1;
if (this.currentPageNum < this.totalPageNum) {
this.hasPreviousPage = true;
this.hasNextPage = true;
} else {
this.hasPreviousPage = true;
this.hasNextPage = false;
}
}
return this.getPageMessage();
}
// 获得指定页信息
public List getAppointPage(Session session, int currentPageNum) throws HibernateException {
this.session = session;
if (currentPageNum > 0 & currentPageNum <= this.totalPageNum) {
this.currentPageNum = currentPageNum;
if (this.currentPageNum > 1) {
this.hasPreviousPage = true;
} else {
this.hasPreviousPage = false;
}
if (this.currentPageNum < this.totalPageNum) {
this.hasNextPage = true;
} else {
this.hasNextPage = false;
}
}
return this.getPageMessage();
}
// 检索指定信息的方法
private List getPageMessage() throws HibernateException {
Query q = session.createQuery(hql);
q.setFirstResult((this.currentPageNum - 1) * this.pageCount);
q.setMaxResults(this.pageCount);
this.print();
return q.list();
}
// 测试方法
public void print() {
System.out.println("------当前是第:" + this.getCurrentPageNum() + "/" +
this.getTotalPageNum() + "页");
System.out.print(" HasPreviousPage:" + this.isHasPreviousPage());
System.out.print(" HasNextPage:" + this.isHasNextPage());
}
// 返回参数值的一些方法
public int getTotalCount() {
return totalCount;
}
public int getPageCount() {
return pageCount;
}
public boolean isHasPreviousPage() {
return hasPreviousPage;
}
public boolean isHasNextPage() {
return hasNextPage;
}
public int getTotalPageNum() {
return totalPageNum;
}
public int getCurrentPageNum() {
return currentPageNum;
}
}
// 导入相关包文件
import java.util.List;
// 导入hibernate2资源包文件
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Query;
import net.sf.hibernate.Session;
public class PaginationInfo {
private Session session; // session对象
private String hql = "";
private int totalCount = 0;
private int pageCount = 3; // 每页的显示的数据项
private boolean hasPreviousPage = false; // 上一页
private boolean hasNextPage = false; // 下一页
private int totalPageNum = 1;
private int currentPageNum = 1;
// 私有的构造函数
public PaginationInfo() {
}
// 初始化分页信息
public void init(Session session, String hql, int pageCount) throws Exception {
this.session = session;
this.hql = hql;
this.pageCount = pageCount;
totalCount = ((Integer) session.createQuery("select count(*)" + hql).
uniqueResult()).intValue();
if (this.totalCount % this.pageCount == 0) {
this.totalPageNum = this.totalCount / this.pageCount;
} else {
this.totalPageNum = this.totalCount / this.pageCount + 1;
}
if (this.totalPageNum > 1) {
this.hasNextPage = true;
}
}
// 获得前一页信息
public List getPreviousPage(Session session) throws HibernateException {
this.session = session;
if (this.getCurrentPageNum() > 1) {
this.currentPageNum = this.currentPageNum - 1;
if (this.currentPageNum > 1) {
this.hasPreviousPage = true;
this.hasNextPage = true;
} else {
this.hasPreviousPage = false;
this.hasNextPage = true;
}
}
return this.getPageMessage();
}
// 获得当前页信息
public List getCurrentPage(Session session) throws Exception {
this.session = session;
return this.getPageMessage();
}
// 获得下一页信息
public List getNextPage(Session session) throws Exception {
this.session = session;
if (this.getCurrentPageNum() < this.totalPageNum) {
this.currentPageNum = this.currentPageNum + 1;
if (this.currentPageNum < this.totalPageNum) {
this.hasPreviousPage = true;
this.hasNextPage = true;
} else {
this.hasPreviousPage = true;
this.hasNextPage = false;
}
}
return this.getPageMessage();
}
// 获得指定页信息
public List getAppointPage(Session session, int currentPageNum) throws HibernateException {
this.session = session;
if (currentPageNum > 0 & currentPageNum <= this.totalPageNum) {
this.currentPageNum = currentPageNum;
if (this.currentPageNum > 1) {
this.hasPreviousPage = true;
} else {
this.hasPreviousPage = false;
}
if (this.currentPageNum < this.totalPageNum) {
this.hasNextPage = true;
} else {
this.hasNextPage = false;
}
}
return this.getPageMessage();
}
// 检索指定信息的方法
private List getPageMessage() throws HibernateException {
Query q = session.createQuery(hql);
q.setFirstResult((this.currentPageNum - 1) * this.pageCount);
q.setMaxResults(this.pageCount);
this.print();
return q.list();
}
// 测试方法
public void print() {
System.out.println("------当前是第:" + this.getCurrentPageNum() + "/" +
this.getTotalPageNum() + "页");
System.out.print(" HasPreviousPage:" + this.isHasPreviousPage());
System.out.print(" HasNextPage:" + this.isHasNextPage());
}
// 返回参数值的一些方法
public int getTotalCount() {
return totalCount;
}
public int getPageCount() {
return pageCount;
}
public boolean isHasPreviousPage() {
return hasPreviousPage;
}
public boolean isHasNextPage() {
return hasNextPage;
}
public int getTotalPageNum() {
return totalPageNum;
}
public int getCurrentPageNum() {
return currentPageNum;
}
}
发表评论
-
IBM appscan 扫描问题解决
2012-07-24 16:52 1633http://serisboy.iteye.com/blog/ ... -
struts+hibernate 错误记录
2012-04-01 11:15 779今天,在做练习的时候,包错: org.hibernate.Hi ... -
一个很好用的jsp分页Bean
2009-11-19 11:17 1539import java.sql.*; import beans ... -
Hibernate分页bean
2009-11-13 15:36 1171package mrmwq; // 导入相关包文件 impo ... -
hibernate 延迟加载问题探讨
2009-11-13 13:19 1192延迟初始化错误是运用H ... -
如何把Hibernate2.1升级到Hibernate3.0?
2009-11-13 13:10 1057选自<<精通Hibernate ... -
struts+hibernate用的分页Bean
2009-11-12 21:42 1405package org.infosys.util; impo ... -
Hibernate一例
2009-11-11 11:38 928package dao; import java.util. ... -
DetachedCriteria离线查询
2009-11-11 11:36 1236//在Action中 拼查询条件 public Action ... -
Hibernate n+1问题
2009-11-11 11:34 2371Hibernate 中常会用到set,bag等集合表示1 对多 ... -
Hibernate分页查询与泛型
2009-11-11 11:29 1294package common.dao; /** * 分页功 ... -
Hibernate批量删除
2009-11-11 11:27 1034public void delete(final List&l ...
相关推荐
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <ref bean="sessionFactory"/> </bean> <!-- 新闻类型 --> <bean id="newsclassDAO" class=...
25.1.3 编写Enterprise Java Bean类 25.2 在业务代理类中访问EJB组件 25.3 发布J2EE应用 25.3.1 在JBoss上部署EJB组件 25.3.2 在JBoss上部署Web应用 25.3.3 在JBoss上部署J2EE应用 25.4 小结 ...
J2EE三大框架_笔记 共分三块: J2EE框架_笔记_a: 1-JSP+JDBC_假分页笔记 2-JSP+JDBC_真分页(基于Oracle数据库...53使用Struts + Spring + Hibernate完成分页笔记 54留言管理程序_Struts + Spring + Hibernate笔记
J2EE三大框架_笔记 共分三块: J2EE框架_笔记_a: 1-JSP+JDBC_假分页笔记 2-JSP+JDBC_真分页(基于Oracle数据库...53使用Struts + Spring + Hibernate完成分页笔记 54留言管理程序_Struts + Spring + Hibernate笔记
53使用Struts + Spring + Hibernate完成分页笔记.pdf 54留言管理程序_Struts + Spring + Hibernate笔记.pdf 6-Struts标签-BEAN标签笔记.pdf 7-Struts标签 -LOGIC标签笔记.pdf 8-Struts标签- HTML标签笔记.pdf 9-...
将DataSource、SessionFactory、Transaction等作为Spring的Bean,通过配置文件的方式来管理。 24.1 概述 24.1.1 概述 Spring提供了DAO支持,可以简化DAO组件的开发,特别是IoC容器的使用,提供了DAO组件与业务...
J2EE三大框架_笔记 共分三块: J2EE框架_笔记_a: 1-JSP+JDBC_假分页笔记 2-JSP+JDBC_真分页(基于Oracle数据库...53使用Struts + Spring + Hibernate完成分页笔记 54留言管理程序_Struts + Spring + Hibernate笔记
java基于SSH框架的学生成绩管理系统源码。要求: (1) 整合Struts2、Spring和Hibernate框架... (3) 在Spring配置文件中增加该DAO层实现类的定义,并需要依赖注入一个SessionFactory bean的引用。 7、 开发Service
本例主要是实现了struts2+spring3+hibernate3的 基本框架搭建的注册登录,以及用户增删改查,适于初学者学习。 包括:注册 登录功能 分页的实现 前端校验 验证码的实现 注册时有ajax 校验,登录时 后台从数据库...
如果不使用Hibernate自带的分页,则采用什么方式分页? 3 1.4. hibernate的对象的三种持久化状态,并给出解释? 3 1.5. hibernate的三种状态之间如何转换 3 1.6. hibernate中一对多配置文件返回的是什么? 4 1.7. ...
25.1.3 编写Enterprise Java Bean类 25.2 在业务代理类中访问EJB组件 25.3 发布J2EE应用 25.3.1 在JBoss上部署EJB组件 25.3.2 在JBoss上部署Web应用 25.3.3 在JBoss上部署J2EE应用 25.4 小结 ...
控制转发层采用Servlet,数据访问层采用Hibernate(bean和dao是由Hibernate逆向工程自动生成)。 系统采用分层架构,由上到下分为视图层、控制转发层、业务层、服务层、数据库访问层。运用了一些基本设计模式,系统...
25.1.3 编写Enterprise Java Bean类 25.2 在业务代理类中访问EJB组件 25.3 发布J2EE应用 25.3.1 在JBoss上部署EJB组件 25.3.2 在JBoss上部署Web应用 25.3.3 在JBoss上部署J2EE应用 25.4 小结 ...
25.1.3 编写Enterprise Java Bean类 25.2 在业务代理类中访问EJB组件 25.3 发布J2EE应用 25.3.1 在JBoss上部署EJB组件 25.3.2 在JBoss上部署Web应用 25.3.3 在JBoss上部署J2EE应用 25.4 小结 ...
假分页 02 JSP+JDBC_真分页(基于MySQL数据库分页) 03 JSP+DAO和MVC+DAO(基于MySQL数据库分页) 04 Struts入门 05 使用Struts + DAO完成用户登陆 06 Struts标签-BEAN标签 07 Struts标签 -...
struts2.1.8+hibernate3.5.5+spring3.0.2+mysql5.1+jdk1.6 使用SSH整合实现对一个bean的增删改查 实现的功能为: 排序,搜索,分页
自已写的一个demo 1 基于SSH,service采用 annotation注入减少配置 2 利用struts2 的LoginAction-validation.xml 3 在bean里把service包;...5 加入display的分页,并且是物理分页 打开后自已建表sql.txt jdbc.properties
JSP文件--> 具有Struts2.0支持的增、删、改、查页面及自定义查询、自动分页等操作 Action--> 业务Action.java和导出Excel的Action等 VO --> bean.java及 bean.hbm.xml配置文件 Service --> Service接口定义类 ...
(Struts 2+Spring 2+Hibernate 3).pdf(完整版) 网上有高清版350M的。可以去下 http://115.com/file/be5gwid8 请于下载后 24H 内及时删除!请抱着学习的态度下载此资料。 总共900多页!!!!!!! 第1篇 ...