ForumNewsManager.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 net.acai.forum.ForumNewsNotFoundException;
  11. import net.acai.database.*;
  12. import java.util.Vector;
  13. import java.sql.*;
  14. public class ForumNewsManager{
  15. public static ForumNews getForumNews(int forumID)
  16. throws ForumNewsNotFoundException{
  17. try{
  18. ForumNews temp=new ForumNews(forumID);
  19. return temp;
  20. }
  21. catch(Exception e)
  22. {
  23. throw new ForumNewsNotFoundException();
  24. }
  25. }
  26. public static ForumNews getSignalForumNews(int newsID) throws Exception{
  27. DBConnect dbc=new DBConnect("select * from bbs.bbsnews where id="+newsID);
  28. ResultSet rs=dbc.executeQuery();
  29. rs.next();
  30. ForumNews forumNews=new ForumNews();
  31. forumNews.setId(rs.getInt(1));
  32. forumNews.setBoardid(rs.getInt(2));
  33. forumNews.setTitle(rs.getString(3));
  34. forumNews.setContent(rs.getString(4));
  35. forumNews.setUserName(rs.getString(5));
  36. forumNews.setAddTime(rs.getString(6));
  37. return forumNews;
  38. }
  39. public static Vector getForumNewsVector() throws Exception{
  40. DBConnect dbc=new DBConnect("select * from bbs.bbsnews  order by id desc");
  41. ResultSet rs=dbc.executeQuery();
  42. Vector forumNewsVector=new Vector();
  43. while(rs.next()){
  44. ForumNews forumNews=new ForumNews();
  45. forumNews.setId(rs.getInt(1));
  46. forumNews.setBoardid(rs.getInt(2));
  47. forumNews.setTitle(rs.getString(3));
  48. forumNews.setContent(rs.getString(4));
  49. forumNews.setUserName(rs.getString(5));
  50. forumNews.setAddTime(rs.getString(6));
  51. forumNewsVector.add(forumNews);
  52. }
  53. dbc.close();
  54. return forumNewsVector;
  55. }
  56. public static Vector getForumNewsVector(int forumID) throws Exception{
  57. DBConnect dbc=new DBConnect("select * from bbs.bbsnews where boardID="+forumID+" order by id desc");
  58. ResultSet rs=dbc.executeQuery();
  59. Vector forumNewsVector=new Vector();
  60. while(rs.next()){
  61. ForumNews forumNews=new ForumNews();
  62. forumNews.setId(rs.getInt(1));
  63. forumNews.setBoardid(rs.getInt(2));
  64. forumNews.setTitle(rs.getString(3));
  65. forumNews.setContent(rs.getString(4));
  66. forumNews.setUserName(rs.getString(5));
  67. forumNews.setAddTime(rs.getString(6));
  68. forumNewsVector.add(forumNews);
  69. }
  70. dbc.close();
  71. return forumNewsVector;
  72. }
  73. }