listallorderaction.java

来自「该系统的主要功能是」· Java 代码 · 共 40 行

JAVA
40
字号
package com.laoniu.web.action;import java.util.Map;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import com.laoniu.bean.Orderform;import com.laoniu.common.BeanFactory;import com.laoniu.common.exception.OrderServiceException;import com.laoniu.service.IOrderService;public class ListAllorderAction extends Action{	@Override	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception 	{		IOrderService service=(IOrderService) BeanFactory.getBean(BeanFactory.ORDERSERVICE);		Map<Long,Orderform> orders=null;		try {			orders=service.listAllorder();			if(orders.size()==0)				throw new OrderServiceException("无法查找全部订单");			req.getSession().setAttribute("allorder",orders);			return mapping.findForward("success");		} catch (OrderServiceException e) {			e.printStackTrace();			req.setAttribute("message",e.getMessage());			return mapping.findForward("failure");		}	}	}

⌨️ 快捷键说明

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