ForumLinkFactory.java
上传用户:toby834
上传日期:2013-10-21
资源大小:2613k
文件大小:2k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. package net.acai.forum;
  2. /**
  3.  * Title:        清清网络
  4.  * Description:
  5.  * Copyright:    Copyright (c) 2002
  6.  * Company:      www.SuperSpace.com
  7.  * @author:       SuperSpace
  8.  * @version 1.0
  9.  */
  10. import java.sql.ResultSet;
  11. import java.util.Vector;
  12. import net.acai.database.*;
  13. import net.acai.forum.ForumLinkNotFoundException;
  14. public class ForumLinkFactory{
  15. public static Vector getForumLinks() throws ForumLinkNotFoundException{
  16. try{
  17. DBConnect dbc=new DBConnect("select * from bbs.bbslink order by id");
  18. ResultSet rs=dbc.executeQuery();
  19. Vector forumLinkVector=new Vector();
  20. while(rs.next()){
  21. ForumLink tempLink=new ForumLink();
  22. tempLink.setLinkID(rs.getInt(1));
  23. tempLink.setForumName(rs.getString(2));
  24. tempLink.setReadMe(rs.getString(3));
  25. tempLink.setForumURL(rs.getString(4));
  26. forumLinkVector.add(tempLink);
  27. }
  28. dbc.close();
  29. return forumLinkVector;
  30. }
  31. catch(Exception e){
  32. e.printStackTrace();
  33. throw new ForumLinkNotFoundException();
  34. }
  35. }
  36. public static ForumLink getForumLink(int forumLinkID) throws Exception{
  37. DBConnect dbc=new DBConnect("select * from bbs.bbslink  where id="+forumLinkID);
  38. ResultSet rs=dbc.executeQuery();
  39. if(!rs.next())
  40. throw new Exception("对不起,没有发现此联盟论坛!");
  41. //rs.next();
  42. ForumLink tempLink=new ForumLink();
  43. tempLink.setLinkID(rs.getInt(1));
  44. tempLink.setForumName(rs.getString(2));
  45. tempLink.setReadMe(rs.getString(3));
  46. tempLink.setForumURL(rs.getString(4));
  47. dbc.close();
  48. return tempLink;
  49. }
  50. }