?? cplistaction.java
字號:
package com.longtime.wap.module.business.web.action;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.LabelValueBean;
import org.springframework.web.struts.DispatchActionSupport;
import com.longtime.wap.model.Cp;
import com.longtime.wap.module.business.common.BusinessConstant;
import com.longtime.wap.module.business.service.BusinessService;
import com.longtime.wap.module.business.web.form.CpListForm;
/**
* 處理列表頁請求
*
* @author gengb
* @date Nov 19, 2007
*/
public class CpListAction extends DispatchActionSupport {
private static final Log LOGGER =
LogFactory.getLog(CpListAction.class);
private BusinessService businessService;
/**
* 注入服務對象
*
* @param businessService
* 服務對象
*/
public void setBusinessService(BusinessService businessService) {
this.businessService = businessService;
}
/**
* 處理cp列表頁請求
*
* @param mapping
* ActionMapping對象
* @param form
* ActionForm對象
* @param request
* HttpServletRequest對象
* @param response
* HttpServletResponse對象
* @return ActionForward對象
*/
public ActionForward listCp(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
try {
List cpList = (List) businessService.getCps();
List<LabelValueBean> returnCpList = new ArrayList<LabelValueBean>();
for (int i = 0; i < cpList.size(); i++) {
Cp cp = (Cp) cpList.get(i);
returnCpList.add(new LabelValueBean(cp.getCompanyName(),
String.valueOf(cp.getCpId())));
}
request.setAttribute(BusinessConstant.CP_LIST, returnCpList);
} catch (Exception ex) {
LOGGER.error(ex);
ex.printStackTrace();
}
return mapping.findForward("listCp");
}
/**
* 處理cp業(yè)務列表頁請求
*
* @param mapping
* ActionMapping對象
* @param form
* ActionForm對象
* @param request
* HttpServletRequest對象
* @param response
* HttpServletResponse對象
* @return ActionForward對象
*/
public ActionForward listCpBusiness(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
CpListForm cf = (CpListForm) form;
String cpId = cf.getCpId();
request.setAttribute(BusinessConstant.CP_ID, cpId);
return mapping.findForward("listCpBusiness");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -