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

📄 planemsgbean.java

📁 这是jsp通用模块导航的程序原代码,里面有新闻,bbs等jsp与javabean结合的程序.
💻 JAVA
字号:
package com.wxpn.tutorial.ec.bean;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;

import com.wxpn.tutorial.db.ConnectionPool;
import com.wxpn.tutorial.db.DB;
import com.wxpn.tutorial.ec.util.DBAccess;
import com.wxpn.tutorial.ec.util.TravValueMapBean;


public class PlaneMsgBean {
	private DBAccess db=null;
    //state the table' name
    private String sTableName="planetable";
	
	public void PlaneOrderBean()  {

	}
	
	 public void deletePlaneInfoBykey(int key) throws Exception{
			db=new DBAccess();
			try{
				db.performDeleteByKey(sTableName,key);
			} catch (Exception e) {
				e.printStackTrace();
			}
	}
	 
	 public void insertPlaneInfo(HashMap map) throws Exception{
			db=new DBAccess();
			try{
				db.performInsert(sTableName,map);
			}catch(Exception e){

					e.printStackTrace();
			
			}
	}
	 
	 public String getAddSeqNum() throws SQLException{
         
		 ConnectionPool connPool = DB.getConnPool();
		 Connection conn = connPool.getConnection();
		 Statement stmt = conn.createStatement();
	     ResultSet result=null;
		 String maxid = "1";
	     
	     String sqlStr="select max(hotelorderid) from "+sTableName;
     
     try{
		 result=stmt.executeQuery(sqlStr);
		 maxid=result.getString("planeorderid");

         
     }catch (Exception e){
		 e.printStackTrace();
			
	}   finally {
		// 关闭连接,释放数据库资源:
		try {
			
			if (stmt != null) {
				stmt.close();
			}
			connPool.freeConnection(conn);
		} catch (SQLException sqlExc) {
			sqlExc.printStackTrace();
		}
	}  
	  return maxid;  
	      
 }
   public Collection getResultList(){
 
		Collection  resultList =null;
		 String tableName="planetable";
			db=new DBAccess();
		 try{
	
		
		 resultList=(Collection)db.getAll(tableName);
		 
     }catch(Exception e){
	  e.printStackTrace();	 
	 }
	   return resultList;
     }
	 
	 public Collection getResultList(String clause){
		 
		 String tableName="planetable";
		 Collection  resultList =null;
			db=new DBAccess();
		 try{
		
		 resultList=(Collection)db.getAllByClause(tableName,clause);
		 
     }catch(Exception e){
	  e.printStackTrace();	 
	 }
		return resultList;
     }
	 public int getCount(String clause) {
			// 创建数据库连接对象:
			String sTableName="planetable";
			db=new DBAccess();
			try {
				int count=db.getCount(sTableName,clause);
				return count;
			} catch (Exception e) {
				e.printStackTrace();
				return 0;
			} 
			
		}
	 
	 public Collection getAll(int pagesize, int page,String clause) {
		 String sTableName="planetable";
		 Collection resultList=null;
			db=new DBAccess();
			try {
				resultList=(Collection)db.getAll(sTableName,pagesize,page,clause);
				return resultList;
			} catch (Exception e) {
				e.printStackTrace();
				return null;
			} 
	 }
			// 创建数据库连接对象
}

⌨️ 快捷键说明

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