📄 informationsearchaction.java
字号:
package com.longtime.wap.module.front.web.action;
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;
import com.longtime.wap.module.front.web.form.SearchInformationForm;
/**
* 信息搜索请求
*
* @author bulc
* @date Nov 19, 2007
*/
public class InformationSearchAction extends FrontBaseAction {
private static final Log LOGGER =
LogFactory.getLog(InformationSearchAction.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 searchInfo(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
SearchInformationForm searchForm = (SearchInformationForm) form;
try {
Page page = null;
String pageNumber = request.getParameter(PageConstant.PARA_PAGE);
if (GenericValidator.isBlankOrNull(pageNumber)) {
page = new Page(1);
} else {
page = new Page(Integer.parseInt(pageNumber));
}
request.setAttribute(FrontConstant.INFORMATIONS_LIST,
super.filtInformationsContent(
frontService.getInfosByContent(
searchForm.getSearchValue(), page),
frontService,page));
request.setAttribute(PageConstant.ATTR_PAGE, page);
} catch (Exception ex) {
LOGGER.error(ex);
ex.printStackTrace();
}
super.setHeader(request, frontService);
super.setLeft(request, frontService);
return mapping.findForward("informationList");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -