customergroupforumlistaction.java
来自「基于struts的网上商店源码」· Java 代码 · 共 80 行
JAVA
80 行
/*
* 作者:李斌
* 时间:2007年12月04日
* 功能:创建用户群
*/
package com.mole.struts.action;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.mole.struts.bean.CustomerGroupForumListBean;
import com.mole.struts.bean.Page;
import com.mole.struts.dao.CustomerGroupForumListDAO;
/**
* MyEclipse Struts Creation date: 12-04-2007 Creator: Li Bin XDoclet
* definition:
*
* @struts.action input="/customerGroupForumList.jsp" validate="true"
* @struts.action-forward name="goForumList" path="/customerGroupForumList.jsp"
*/
public class CustomerGroupForumListAction extends Action {
/*
* Generated Methods
*/
private CustomerGroupForumListDAO dao;
private ArrayList<CustomerGroupForumListBean> list;
/**
* Method execute
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
// 获取群论坛帖子列表
if (null == dao)
dao = new CustomerGroupForumListDAO();
Page page = new Page();
String groupID = request.getParameter("groupID");
String visitorID = request.getParameter("vid");
int pageSize = (request.getParameter("pageSizeSelect") == null ? 10
: Integer.parseInt(request.getParameter("pageSizeSelect")));
int currentPage = (request.getParameter("page") == null ? 1 : Integer
.parseInt(request.getParameter("page")));
int count = dao.getPageInfo(groupID, pageSize);
page.setPageSize(pageSize);
page.setRecordCount(count);
page.setPageCount((count + pageSize - 1) / pageSize);
page.setCurrentPage(currentPage);
list = new ArrayList<CustomerGroupForumListBean>();
try {
list = dao.queryGroups(groupID, page.getCurrentPage());
} catch (Exception e) {
e.printStackTrace();
HttpSession session = request.getSession();
session.setAttribute("title", "错误信息");
session.setAttribute("message", "用户名或密码错误,请重新登陆!");
session.setAttribute("returnUrl", "show.do?action=goLogin");
return mapping.findForward("goMessage");
}
request.setAttribute("GroupID", groupID);
request.setAttribute("GroupForumList", list);
request.setAttribute("Page", page);
return mapping.findForward("goForumList");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?