資源簡介
里面包含了可運行的工程文件,數(shù)據(jù)庫文件SQL Server 2005的,Tomcat6.x的運行文件。內(nèi)含設計說明文檔。這個系統(tǒng)包含了博客的一般功能。

代碼片段和文件信息
package?dao;
import?java.sql.ResultSet;
import?java.sql.SQLException;
import?java.util.ArrayList;
import?java.util.List;
import?toolsbean.DB;
import?valuebean.ArticleBean;
public?class?ArticleDao?{
private?DB?connection?=?null;
private?ArticleBean?articleBean?=?null;
public?ArticleDao()?{
connection?=?new?DB();
}
/**
?*?@功能?實現(xiàn)對文章進行增、刪、改的操作
?*?@參數(shù)?oper為一個String類型變量,用來表示要進行的操作;single為ArticleBean類對象,用來存儲某個文章的信息
?*?@返回值?boolean型值
?*/
public?boolean?operationArticle(String?oper?ArticleBean?single)?{
/*?生成SQL語句?*/
String?sql?=?null;
if?(oper.equals(“add“)) //發(fā)表新文章
sql?=?“insert?into?tb_article?values?(‘“?+?single.getTypeId()?+?“‘‘“+?single.gettitle()?+?“‘‘“?+?single.getContent()?+?“‘‘“+?single.getSdTime()+?“‘‘“+single.getCreate()+“‘‘“?+?single.getInfo()+“‘“+single.getCount()?+?“)“;
if?(oper.equals(“modify“)) //修改文章
sql?=?“update?tb_article?set?article_typeID=“?+?single.getTypeId()+?“article_title=‘“?+?single.gettitle()?+?“‘a(chǎn)rticle_content=‘“+?single.getContent()?+“‘a(chǎn)rticle_create=‘“+single.getCreate()+?“‘a(chǎn)rticle_info=‘“+single.getInfo()+“‘?where?id=“?+?single.getId();
if?(oper.equals(“delete“)) //刪除文章
sql?=?“delete?from?tb_article?where?id=“?+?single.getId();
if?(oper.equals(“readTimes“)) //累加閱讀次數(shù)
sql?=?“update?tb_article?set?article_count=article_count+1?where?id=“+?single.getId();
/*?執(zhí)行SQL語句?*/
boolean?flag?=connection.executeUpdate(sql);
return?flag;
}
/**?
?*?@功能?查詢指定類別的文章
?*?@參數(shù)?typeId表示文章類別ID值
?*?@返回值?List集合
?*/
public?List?queryArticle(int?typeIdString?type)?{
List?articlelist?=?new?ArrayList();
String?sql?=?““;
if?(typeId?<=0) //不按類別查詢,查詢出前3條記錄
sql?=?“select?top?3?*?from?tb_article?order?by?article_sdTime?DESC“;
else //按類別查詢
if(type==null||type.equals(““)||!type.equals(“all“))
sql?=?“select?top?5?*?from?tb_article?where?article_typeID=“?+?typeId+?“?order?by?article_sdTime?DESC“;
else
sql?=?“select?*?from?tb_article?where?article_typeID=“?+?typeId+?“?order?by?article_sdTime?DESC“;
ResultSet?rs?=?connection.executeQuery(sql);
if(rs!=null){
try?{
while?(rs.next())?{
/*?獲取文章信息?*/
articleBean?=?new?ArticleBean();
articleBean.setId(rs.getInt(1));
articleBean.setTypeId(rs.getInt(2));
articleBean.settitle(rs.getString(3));
articleBean.setContent(rs.getString(4));
articleBean.setSdTime(rs.getString(5));
articleBean.setCreate(rs.getString(6));
articleBean.setInfo(rs.getString(7));
articleBean.setCount(rs.getInt(8));
/*?查詢tb_review數(shù)據(jù)表統(tǒng)計當前文章的評論數(shù)?*/
sql=“select?count(id)?from?tb_review?where?review_articleId=“+articleBean.getId();
ResultSet?rsr=connection.executeQuery(sql);
if(rsr!=null){
rsr.next();
articleBean.setReview(rsr.getInt(1));
rsr.close();
}
articlelist.add(articleBean);
}
}?catch?(SQLException?e)?{
e.printSta
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-05-10?19:18??dateba
?????文件?????1835008??2013-05-10?19:18??dateba
?????文件?????1048576??2013-05-10?19:18??dateba
?????文件?????1499804??2013-05-10?17:13??Java綜合項目實踐說明書.wps
?????文件???????11879??2013-05-04?16:22??jspsmartupload.jar
?????目錄???????????0??2013-05-10?19:19??myblog?服務器端\
?????目錄???????????0??2013-05-10?19:19??myblog?服務器端\admin\
?????文件?????????687??2013-05-06?13:32??myblog?服務器端\admin\AdminIndex.jsp
?????目錄???????????0??2013-05-10?19:19??myblog?服務器端\admin\article\
?????文件????????3331??2013-05-06?20:18??myblog?服務器端\admin\article\ArticleAdd.jsp
?????文件????????3457??2013-05-05?15:07??myblog?服務器端\admin\article\ArticleList.jsp
?????文件????????4454??2013-05-05?15:07??myblog?服務器端\admin\article\ArticleModify.jsp
?????文件????????2165??2013-05-05?15:07??myblog?服務器端\admin\article\ArticleSingle.jsp
?????文件????????1660??2013-05-05?15:07??myblog?服務器端\admin\article\ArticleTypeAdd.jsp
?????文件????????2080??2013-05-05?15:07??myblog?服務器端\admin\article\ArticleTypeList.jsp
?????文件????????2151??2013-05-05?15:07??myblog?服務器端\admin\article\ArticleTypeModify.jsp
?????文件????????1111??2013-05-05?15:07??myblog?服務器端\admin\error.jsp
?????目錄???????????0??2013-05-10?19:19??myblog?服務器端\admin\friend\
?????文件????????2174??2013-05-05?15:07??myblog?服務器端\admin\friend\FriendAdd.jsp
?????文件????????2254??2013-05-05?15:07??myblog?服務器端\admin\friend\FriendList.jsp
?????文件????????2975??2013-05-05?15:07??myblog?服務器端\admin\friend\FriendModify.jsp
?????文件????????2104??2013-05-05?15:07??myblog?服務器端\admin\friend\FriendSingle.jsp
?????文件????????1530??2013-05-05?15:07??myblog?服務器端\admin\logon.jsp
?????目錄???????????0??2013-05-10?19:19??myblog?服務器端\admin\master\
?????文件?????????583??2013-05-05?15:07??myblog?服務器端\admin\master\MyModify.jsp
?????文件?????????540??2013-05-05?15:07??myblog?服務器端\admin\master\MySingle.jsp
?????目錄???????????0??2013-05-10?19:19??myblog?服務器端\admin\photo\
?????文件????????2551??2013-05-05?15:07??myblog?服務器端\admin\photo\PhotoList.jsp
?????文件?????????540??2013-05-05?15:07??myblog?服務器端\admin\photo\PhotoModify.jsp
?????文件?????????540??2013-05-05?15:07??myblog?服務器端\admin\photo\PhotoSingle.jsp
?????文件????????1619??2013-05-05?15:07??myblog?服務器端\admin\photo\PhotoUpload.jsp
............此處省略266個文件信息
評論
共有 條評論