📄 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业务列表页请求
*
* @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 + -