⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pagebusiness.java

📁 IBM提供的购物车
💻 JAVA
字号:
package com.webshop.page;
import java.sql.*;
import java.util.*;

/**
 * @author hellking
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
/**
 *抽象了分页显示的业务逻辑
 */
public abstract class PageBusiness 
{
	public java.util.Vector v;//要显示的信息。
	/**
	 *获得所有记录的数量
	 */
	public abstract int getAvailableCount(String conditions)throws Exception;
	/**
	 *返回要显示的信息
	 */
	public 	java.util.Vector getResult()throws Exception
	{
		return v;
	}
	/**
	 *一个帮助方法,用于获得指定的表的记录数量
	 */
	protected final int getAvailableCountHelper(Connection conn ,String tableName,String conditions)throws Exception
	{

		int ret=0;
		Statement stmt=conn.createStatement();
		String strSql="select count(*) as counters from "+tableName +" where "+conditions;
		ResultSet rset=stmt.executeQuery(strSql);
		while(rset.next())
		{
			ret=rset.getInt(1);
		}

		return ret;	
	}
	/**
	 *执行数据库操作,返回包含了指定页面信息的PageBean
	 */
	public abstract PageBean listData(String page,String conditions)throws Exception;	
		
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -