showproductaction.java

来自「这是本人曾经在公司里用的,内部开发框架,基于struts+hibernate今天」· Java 代码 · 共 56 行

JAVA
56
字号
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package cn.bway.foreigntrade.reperstory.product.action;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import cn.bway.common.BwayHibernateException;
import cn.bway.common.WebConstant;
import cn.bway.common.action.BaseAction;
import cn.bway.common.vo.PageListVO;
import cn.bway.common.vo.QueryVO;
import cn.bway.foreigntrade.operation.productmanage.form.ProductmanageForm;
import cn.bway.foreigntrade.operation.productmanage.impl.ProductmanageManagerFactory;
import cn.bway.foreigntrade.reperstory.product.form.ProductForm;
import cn.bway.foreigntrade.reperstory.product.impl.ProductManagerFactory;

import java.util.ArrayList;

public class ShowProductAction extends BaseAction {
	/*
	 * Generated Methods
	 */

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {

		ProductForm pForm = (ProductForm) form;
		String returnStr = WebConstant.FORWARD_INITPAGE;		
		try {
			request.setCharacterEncoding("gbk");
			String types=new String (request.getParameter("types").getBytes("iso-8859-1"));
//			System.out.println(types+"====---------------====");
			PageListVO rvo = null;
			QueryVO qvo = new QueryVO();
			qvo.setPageSize(10);// 锟睫改凤拷装锟斤拷页锟斤拷锟斤拷�?20
			qvo.setCurPage(pForm.getPageNum());
			rvo = (PageListVO) ProductManagerFactory.getProductManager().findAllProduct1(qvo,types);
			ArrayList ListResult = (ArrayList) rvo.getretVO();
			setQueryResult(rvo, pForm); // 锟斤拷装锟斤拷页锟斤拷锟�?
			request.setAttribute(WebConstant.RETURN_LIST, ListResult);
			request.setAttribute("types", types);
//			request.getSession().setAttribute("types",types);
		} catch (Exception e) {
			e.printStackTrace();
			return mapping.findForward(WebConstant.FORWARD_FAIL);
		}
		request.setAttribute(WebConstant.PAGE_Object, pForm);
		return mapping.findForward(returnStr);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?