📄 frontindexaction.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.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.longtime.wap.common.WapConstant;
import com.longtime.wap.common.web.Page;
import com.longtime.wap.module.front.common.FrontConstant;
import com.longtime.wap.module.front.service.FrontService;
/**
* 前台信息请求
*
* @author bulc
* @date Nov 19, 2007
*/
public class FrontIndexAction extends FrontBaseAction {
private static final Log LOGGER = LogFactory.getLog(FrontIndexAction.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 index(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
List errors = (List) request
.getAttribute(WapConstant.WAP_GLOBAL_MESSAGES);
if (null != errors && !errors.isEmpty()) {
request.setAttribute(WapConstant.WAP_GLOBAL_MESSAGES, errors);
}
request.setAttribute(FrontConstant.TEXT_TOPVIEW_INFOS, super
.filtInformationsContent(
frontService.getInfosByCategoryAndViewCount(0,
new Page(1, 20)), frontService, 5));
request.setAttribute(FrontConstant.MUSIC_TOPVIEW_INFOS, super
.filtInformationsContent(
frontService.getInfosByCategoryAndViewCount(1,
new Page(1, 20)), frontService, 5));
request.setAttribute(FrontConstant.PIC_TOPVIEW_INFOS, super
.filtInformationsContent(
frontService.getInfosByCategoryAndViewCount(2,
new Page(1, 20)), frontService, 5));
request.setAttribute(FrontConstant.TEXT_BUSINESSES, frontService
.getBusinessesByCategory(0, new Page(1, 3)));
request.setAttribute(FrontConstant.MUSIC_BUSINESSES, frontService
.getBusinessesByCategory(1, new Page(1, 3)));
request.setAttribute(FrontConstant.PIC_BUSINESSES, frontService
.getBusinessesByCategory(2, new Page(1, 3)));
} catch (Exception ex) {
LOGGER.error(ex);
ex.printStackTrace();
}
super.setHeader(request, frontService);
super.setLeft(request, frontService);
return mapping.findForward("index");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -