?? accountcontrolaction.java
字號:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.struts.action;
import java.util.Iterator;
import java.util.List;
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.web.model.Account;
import com.web.model.Credit;
import com.web.model.FoodInfo;
import com.web.model.FoodStyle;
import com.web.model.UserInfo;
import com.web.servic.Account_Intef;
import com.web.servic.Credit_Intef;
import com.web.servic.FoodInfo_Intef;
import com.web.servic.FoodStyle_Intef;
import com.web.util.PageController;
import com.web.util.ToolBar;
/**
* MyEclipse Struts
* Creation date: 08-28-2008
*
* XDoclet definition:
* @struts.action validate="true"
* @struts.action-forward name="foodlist" path="/foodlist.jsp"
*/
public class AccountControlAction extends Action {
/*
* Generated Methods
*/
private Account_Intef Account_Intef ;
private FoodStyle_Intef foodStyle_Intef ;
private Credit_Intef credit_Intef ;
private int PAGE_SIZE;
/**
* 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(request.getSession().getAttribute("Manager")!=null)
{
PAGE_SIZE=10 ;
}
else
{
PAGE_SIZE=10 ;
}
String astate = request.getParameter("astate") ;
if(astate!=null)
{
String accountid = request.getParameter("accountid") ;
Account account = Account_Intef.findById(accountid) ;
account.setAState(Integer.parseInt(astate)) ;
Account_Intef.update(account) ;
}
System.out.println("++++++++++++++++++"+request.getSession().getAttribute("Manager")) ;
List l ;
if(request.getSession().getAttribute("Manager")!=null)
{
l = Account_Intef.findAll();
System.out.println("pppppppppppppppp"+l.size()) ;
}
else
{
UserInfo userinfo = (UserInfo)request.getSession().getAttribute("userinfo") ;
l = Account_Intef.findbyUser(userinfo.getUId());
UserInfo uf = (UserInfo)request.getSession().getAttribute("userinfo") ;
Credit credit = credit_Intef.findCountfyUserInfo(uf.getUId()) ;
System.out.println("_______"+credit.getUCount()) ;
request.getSession().setAttribute("credit", credit.getUCount()) ;
}
request.setAttribute("accountInfos_list", l);
PageController pageC=new PageController(l.size(),PAGE_SIZE);
//ToolBar tb = new ToolBar("pageControl.do",pageC) ;
int page=1;
try {
page = Integer.parseInt(request.getParameter("page"));
} catch (NumberFormatException e) {
}
try {
page = Integer.parseInt(request.getParameter("select"));
} catch (NumberFormatException e) {
}
pageC.setCurrentPage(page);
request.setAttribute("TotalRow", l.size());
request.setAttribute("currPage", pageC.getCurrentPage());
request.setAttribute("TotalPage", pageC.getTotalPages());
request.setAttribute("NextPage", pageC.getNextPage());
request.setAttribute("BackPage", pageC.getPreviousPage());
request.setAttribute("PageStartRow", pageC.getPageStartRow());
request.setAttribute("PageSize", pageC.getPageSize());
if(request.getSession().getAttribute("Manager")!=null)
{
return mapping.findForward("editaccountdetial");
}
else
{
return mapping.findForward("accountControl");
}
}
public FoodStyle_Intef getFoodStyle_Intef() {
return foodStyle_Intef;
}
public void setFoodStyle_Intef(FoodStyle_Intef foodStyle_Intef) {
this.foodStyle_Intef = foodStyle_Intef;
}
public Account_Intef getAccount_Intef() {
return Account_Intef;
}
public void setAccount_Intef(Account_Intef account_Intef) {
Account_Intef = account_Intef;
}
public Credit_Intef getCredit_Intef() {
return credit_Intef;
}
public void setCredit_Intef(Credit_Intef credit_Intef) {
this.credit_Intef = credit_Intef;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -