package org.yufeng.struts.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.yufeng.domains.Article;
import org.yufeng.domains.Assort;
import org.yufeng.domains.Sort;
import org.yufeng.utils.PageService;
import org.yufeng.utils.Tools;
public class ArticleAction extends BaseAction {
// 显示文章
@SuppressWarnings("unchecked")
public ActionForward article_show(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
HttpSession session=request.getSession();
String ar_id=request.getParameter("ar_id");
//显示文章详细信息
Article article=this.getArticleService().loadArticle(new Integer(ar_id));
article.setAr_hits(article.getAr_hits()+1);
this.getArticleService().updateArticle(article);
//获得article类型
Sort sort=this.getSortService().loadSort(article.getAr_sort_id());
Assort assort=this.getAssortService().loadAssort(article.getAr_assort_id());
//周月排行
List article_week_list=this.getArticleService().browseArticle_Week();
List article_month_list=this.getArticleService().browseArticle_Month();
//相关文章的查询
List article_about_list =this.getArticleService().browseAboutArticle(article.getAr_name());
session.setAttribute("article", article);
session.setAttribute("sort", sort);
session.setAttribute("assort", assort);
session.setAttribute("article_week_list", article_week_list);
session.setAttribute("article_month_list", article_month_list);
session.setAttribute("article_about_list", article_about_list);
return mapping.findForward("article");
}
// 显示文章的子类别和文章,通过so_id
@SuppressWarnings("unchecked")
public ActionForward article_show_bysort(ActionMapping mapping,
ActionForm form, HttpServletRequest request,HttpServletResponse response) {
HttpSession session=request.getSession();
session.removeAttribute("search");
String so_id=request.getParameter("so_id");
List alllist=this.getArticleService().browseArticleBySo_id(new Integer(so_id));
List assort_list=this.getAssortService().browseAllAssortById(new Integer(so_id));
for (int i = 0; i < assort_list.size(); i++) {
Assort assort=(Assort) assort_list.get(i);
assort.setAs_count(this.getArticleService().browseArticleByAs_id(assort.getAs_id()).size());
}
List ar_hit_list=getArticleService().browseArticleBySoHits(new Integer(so_id));
// 设置请求分页号
PageService page=new PageService();
String pageId=request.getParameter("pageId");
List article_list=page.getPage(pageId, 10, alllist);
String footer = page.getPageFooter(request.getRequestURI(),
"article_show_bysort&so_id=" + so_id);
session.setAttribute("footer", footer);
session.setAttribute("article_list", article_list);
session.setAttribute("assort_list", assort_list);
session.setAttribute("ar_hit_list", ar_hit_list);
// 排序和查询所用参数
session.setAttribute("so_id", so_id);
session.setAttribute("as_id", "");
session.setAttribute("flag", 3);
session.setAttribute("flagg", 3);
return mapping.findForward("article_show");
}
// 显示文章的子类别和文章,通过as_id
@SuppressWarnings("unchecked")
public ActionForward article_show_byassort(ActionMapping mapping,
ActionForm form, HttpServletRequest request,HttpServletResponse response) {
HttpSession session=request.getSession();
session.removeAttribute("search");
String so_id=request.getParameter("so_id");
String as_id=request.getParameter("as_id");
List alllist=this.getArticleService().browseArticleByAs_id(new Integer(as_id));
List assort_list=this.getAssortService().browseAllAssortById(new Integer(so_id));
List ar_hit_list=this.getArticleService().browseArticleByAsHits(new Integer(as_id));
// 设置请求分页号
PageService page=new PageService();
String pageId=request.getParameter("pageId");
List article_list=page.getPage(pageId, 10, alllist);
String footer = page.getPageFooter(request.getRequestURI(),
"article_show_byassort&so_id=" + so_id + "&as_id=" + as_id);
session.setAttribute("footer", footer);
session.setAttribute("article_list", article_list);// 获得文章列表
session.setAttribute("assort_list", assort_list);// 获得子类别列表
session.setAttribute("ar_hit_list", ar_hit_list);// 热门assort排行列表
session.setAttribute("as_id", as_id);
session.setAttribute("so_id", so_id);
session.setAttribute("flag", 4);
session.setAttribute("flagg", 4);
return mapping.findForward("article_show");
}
// 推荐文章
@SuppressWarnings("unchecked")
public ActionForward article_hot(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession();
List article_list = (List) session.getAttribute("ar_show_list");
// 获得阅读排行信息
List ar_hit_list = getArticleService().browseArticleByHits();
session.setAttribute("flag", 1);
session.setAttribute("flagg", 1);
session.setAttribute("article_list", article_list);
session.setAttribute("ar_hit_list", ar_hit_list);
return mapping.findForward("article_show");
}
// 查找站内文章
@SuppressWarnings("unchecked")
public ActionForward article_search(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession();
String so_id = request.getParameter("so_id");
String search = request.getParameter("search");
// 删除session缓存
session.removeAttribute("article_list");
List ar_hits_list = null;
List alllist = null;
// 判断是否有so_id
if (so_id.equals("0")) {
alllist = getArticleService().browseArticleBysearch(0, search);
ar_hits_list = getArticleService().browseArticleByHits();
session.setAttribute("ar_hit_list", ar_hits_list);// 获得assort阅读排行
session.setAttribute("search_by", "所有分类");// 用于显示查询的作用域sort_name
} else {
alllist = getArticleService().browseArticleBysearch(
new Integer(so_id), search);
ar_hits_list = getArticleService().browseArticleBySoHits(
new Integer(so_id));// 获得子分类阅读排行
List assort_list = getAssortService().browseAllAssortById(
new Integer(so_id));// 获得子分类文章列表
session.setAttribute("ar_hit_list", ar_hits_list);
session.setAttribute("assort_list", assort_list);
Assort assort = (Assort) assort_list.get(0);
Sort sort = getSortService().loadSort(assort.getAs_sort_id()); // 用于显示查询的作用域sort_name
session.setAttribute("search_by", sort.getSo_name()); //
}
session.setAttribute("flag", 2);
session.setAttribute("flagg", 2);
session.setAttribute("so_id", so_id);
session.setAttribute("search", search);
PageService page = new PageService();
// 设置请求分页号
String pageId = request.getParameter("pageId");
List article_list = page.getPage(pageId, 10, alllist);
String footer = page.getPageFooter(request.getRequestURI(),
"article_search&so_id=" + so_id + "&search=" + search);
session.setAttribute("footer", footer);
session.setAttribute("article_list", article_list);
session.setAttribute("search", search);
return mapping.findForward("article_search");
}
// 后台查找文章
@SuppressWarnings("unchecked")
public ActionForward admin_ar_search(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
HttpSession session = request.getSession();
String search = request.getParameter("search");
List article_list = getArticleService()
.browseArticleBysearch(0, search);
Article article = null;
// 获得所有Article信息
for (int i = 0; i < article_list.size(); i++) {
article
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于java的文章管理系统源代码 (526个子文件)
MD5.asp 10KB
ValidationCode.asp 6KB
Config.asp 6KB
Function.asp 5KB
Ads4.asp 4KB
WebLink.asp 2KB
Top.asp 2KB
SQLUser.asp 2KB
IPLockAdmin.asp 2KB
Menu.asp 2KB
Bottom.asp 1KB
Ads3.asp 1KB
Ads7.asp 1KB
IPLockUser.asp 1KB
Ads2.asp 1KB
Ads8.asp 1KB
Message.asp 1KB
Ads6.asp 1KB
Ads5.asp 1KB
Ads1.asp 1KB
SQLAdmin.asp 1008B
Style.asp 637B
Session.asp 413B
Constant.asp 339B
Conn.asp 324B
ArticleAction.class 12KB
ArticleHibernateImpl.class 8KB
ArticleServiceImpl.class 6KB
AdminAction.class 5KB
SortAction.class 5KB
IndexAction.class 4KB
LinkAction.class 3KB
LeaveAction.class 3KB
ArticleForm.class 3KB
PageService.class 3KB
Article.class 3KB
AssortHibernateImpl.class 3KB
Tools.class 3KB
AssortServiceImpl.class 3KB
AjaxServlet.class 3KB
AdminHibernateImpl.class 3KB
LinkServiceImpl.class 3KB
LinkHibernateImpl.class 3KB
SortServiceImpl.class 2KB
SortHibernateImpl.class 2KB
AdminServiceImpl.class 2KB
FilterAdmin.class 2KB
Sort.class 2KB
BaseAction.class 2KB
LeavesHibernateImpl.class 2KB
Leaves.class 2KB
Admin.class 2KB
IArticleDao.class 1KB
Assort.class 1KB
LeavesServiceImpl.class 1KB
IArticleServiceDao.class 1KB
EncodingFilter.class 1KB
Link.class 1KB
AssortAction.class 987B
ListOrder.class 918B
AppContext.class 844B
IAssortServiceDao.class 531B
IAssortDao.class 512B
ILinkServiceDao.class 441B
ILinkDao.class 423B
IAdminServiceDao.class 397B
IAdminDao.class 379B
ISortServiceDao.class 370B
ISortDao.class 353B
ILeavesServiceDao.class 347B
ILeavesDao.class 329B
.classpath 544B
Style.css 11KB
Style.css 11KB
Style.css 2KB
Style.css 2KB
Style.css 2KB
Style.css 2KB
Style.css 2KB
Style.css 2KB
Title_09.gif 3KB
Title_09.gif 3KB
Title_09.gif 3KB
Title_09.gif 3KB
Title_09.gif 3KB
Title_09.gif 3KB
Title_07.gif 2KB
Title_07.gif 2KB
Title_07.gif 2KB
Title_07.gif 2KB
Title_07.gif 2KB
Title_07.gif 2KB
Admin_Menu_Title.gif 2KB
Td_T_Sort.gif 2KB
TD_T_Bg_L.gif 2KB
TD_T_Bg_L.gif 2KB
Admin_T_Bg1.gif 2KB
TD_T_Bg_L.gif 2KB
Td_T_Sort.gif 1KB
Admin_Menu_Bg3.gif 1KB
共 526 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- Joklklsjjm2013-12-31include文件夹里头的ASP是什么东西?
ganminhui
- 粉丝: 0
- 资源: 21
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功