ForumNews.java
上传用户:yuyunping
上传日期:2013-03-21
资源大小:1844k
文件大小:2k
源码类别:

Java书籍

开发平台:

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.database.*;
  11. import java.sql.ResultSet;
  12. import net.acai.forum.ForumNewsNotFoundException;
  13. public class ForumNews
  14. {
  15. private int id,boardid;
  16. private String title,content,username,addtime;
  17. public ForumNews(){}
  18. public ForumNews(int boardid) throws ForumNewsNotFoundException,Exception{
  19. DBConnect dbc=new DBConnect("select * from bbs.bbsnews where boardid=? order by id desc");
  20. dbc.setInt(1,boardid);
  21. ResultSet rs=dbc.executeQuery();
  22. if(rs.next()){
  23. this.id=rs.getInt(1);
  24. this.boardid=boardid;
  25. this.title=rs.getString(3);
  26. this.content=rs.getString(4);
  27. this.username=rs.getString(5);
  28. this.addtime=rs.getString(6);
  29. dbc.close();
  30. }
  31. else {
  32. dbc.close();
  33. throw new ForumNewsNotFoundException(); 
  34. }
  35. }
  36. public int getId(){
  37. return this.id;
  38. }
  39. public void setId(int id){
  40. this.id=id;
  41. }
  42. public int getBoardid(){
  43. return this.boardid;
  44. }
  45. public void setBoardid(int boardid){
  46. this.boardid=boardid;
  47. }
  48. public String getTitle(){
  49. return this.title;
  50. }
  51. public void setTitle(String title){
  52. this.title=title;
  53. }
  54. public String getContent(){
  55. return this.content;
  56. }
  57. public void setContent(String content){
  58. this.content=content;
  59. }
  60. public String getUserName(){
  61. return this.username;
  62. }
  63. public void setUserName(String username){
  64. this.username=username;
  65. }
  66. public String getAddTime(){
  67. return this.addtime;
  68. }
  69. public void setAddTime(String addtime){
  70. this.addtime=addtime;
  71. }
  72. }