📄 businesslistaction.java
字号:
package com.longtime.wap.module.front.web.action;
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.commons.validator.GenericValidator;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.longtime.wap.common.web.Page;
import com.longtime.wap.common.web.PageConstant;
import com.longtime.wap.module.front.common.FrontConstant;
import com.longtime.wap.module.front.service.FrontService;
/**
* 处理业务信息列表请求
*
* @author bulc
* @date Nov 19, 2007
*/
public class BusinessListAction extends FrontBaseAction {
private static final Log LOGGER = LogFactory.getLog(
BusinessListAction.class);
private FrontService frontService;
/**
* 注入服务对象
*
* @param frontService
* 服务对象
*/
public void setFrontService(FrontService frontService) {
this.frontService = frontService;
}
/**
* 业务信息列表请求处理
*
* @param mapping
* ActionMapping对象
* @param form
* ActionForm对象
* @param request
* HttpServletRequest对象
* @param response
* HttpServletResponse对象
* @return ActionForward对象
* @throws Exception
* 异常对象
*/
public ActionForward listBusiness(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
Page page = null;
String pageNumber = request.getParameter(PageConstant.PARA_PAGE);
String categoryId = request.getParameter("categoryId");
if (GenericValidator.isBlankOrNull(pageNumber)) {
page = new Page(1);
} else {
page = new Page(Integer.parseInt(pageNumber));
}
List businessesList;
if (categoryId != null && categoryId.length() > 0
&& !"null".equalsIgnoreCase(categoryId)) {
businessesList = frontService.getBusinessesByCategory(Integer
.parseInt(categoryId), page);
} else {
businessesList = frontService.getBusinesses(page);
}
request.setAttribute(FrontConstant.BUSINESSES_LIST, businessesList);
request.setAttribute(PageConstant.ATTR_PAGE, page);
request.setAttribute(FrontConstant.CATEGORY_ID, categoryId);
} catch (Exception ex) {
LOGGER.error(ex);
ex.printStackTrace();
}
super.setHeader(request, frontService);
super.setLeft(request, frontService);
return mapping.findForward("businessesList");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -