📄 customershoppedaction.java
字号:
/*
* 作者:武律
* 时间:2007年12月19日
* 功能:处理用户消费过的店铺
*/
package com.mole.struts.action;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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.MerchantStoreInfoBean;
import com.mole.struts.bean.Page;
import com.mole.struts.dao.CustomerShoppedDAO;
/**
* MyEclipse Struts Creation date: 12-19-2007
*
* XDoclet definition:
*
* @struts.action input="/customerShopped.jsp" validate="true"
* @struts.action-forward name="goCustomerShopped" path="/customerShopped.jsp"
*/
public class CustomerShoppedAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String cid = request.getSession().getAttribute("user").toString();
CustomerShoppedDAO dao = new CustomerShoppedDAO();
String str = dao.getPublic(cid);
Page page = new Page();
int pageSize = (request.getParameter("pageSizeSelect") == null ? 20
: Integer.parseInt(request.getParameter("pageSizeSelect")));
int currentPage = (request.getParameter("page") == null ? 1 : Integer
.parseInt(request.getParameter("page")));
int count = dao.getCount(cid);
page.setPageSize(pageSize);
page.setRecordCount(count);
page.setPageCount((count + pageSize - 1) / pageSize);
page.setCurrentPage(currentPage);
ArrayList<MerchantStoreInfoBean> al = null;
try {
al = dao.getShopStore(cid, currentPage, pageSize);
} catch (Exception e) {
e.printStackTrace();
}
request.setAttribute("Public", str);
request.setAttribute("ShoppedList", al);
request.setAttribute("Page", page);
return mapping.findForward("goCustomerShopped");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -