?? gatewayfactory.java
字號:
package net.acai.forum;
/**
* Title: 清清網絡
* Description:
* Copyright: Copyright (c) 2002
* Company: www.qingqing.com
* @author: qingqing
* @version 1.0
*/
import net.acai.database.*;
import net.acai.forum.GateWayNotFoundException;
import java.sql.ResultSet;
import java.util.Vector;
import javax.servlet.http.*;
import net.acai.util.*;
public class GateWayFactory{
public static Vector getGateWays() throws GateWayNotFoundException{
try{
DBConnect dbc=new DBConnect("select * from bbs.class order by id");
ResultSet rs=dbc.executeQuery();
Vector gateWayVector=new Vector();
int gateWayID;
String gateWayName;
GateWay gateWay;
while(rs.next()){
gateWayID=rs.getInt(1);
gateWayName=rs.getString(2);
gateWay=new GateWay(gateWayID,gateWayName);
gateWayVector.add(gateWay);
}
dbc.close();
return gateWayVector;
}
catch(Exception e){
throw new GateWayNotFoundException();
}
}
public static GateWay getGateWay(HttpServletRequest request) throws Exception{
int ID;
try{
ID=ParamUtil.getInt(request,"id");
}
catch(Exception e){
throw new Exception("請您選擇您要排序的分類的ID");
}
DBConnect dbc=new DBConnect();
String sql="select id,class from bbs.class where id="+ID;
ResultSet rs=dbc.executeQuery(sql);
if(!rs.next())
throw new Exception("沒有找到相應的論壇分類。");
//rs.next();
GateWay gateWay=new GateWay(rs.getInt(1),rs.getString(2));
dbc.close();
return gateWay;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -