📄 listorderaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.laoniu.web.action;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
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.Customer;
import com.laoniu.bean.Orderform;
import com.laoniu.common.BeanFactory;
import com.laoniu.common.exception.OrderServiceException;
import com.laoniu.service.ICustomerService;
import com.laoniu.service.IOrderService;
/**
* MyEclipse Struts
* Creation date: 04-29-2008
*
* XDoclet definition:
* @struts.action input="/listBookStore.jsp" validate="true"
* @struts.action-forward name="return" path="/listOrder.jsp"
*/
public class ListOrderAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
HttpSession session=request.getSession();
Customer customer=(Customer)session.getAttribute("customer");
Long customerid=customer.getId();
IOrderService os=(IOrderService)BeanFactory.getBean(BeanFactory.ORDERSERVICE);
try {
Map<Long, Orderform> orders=os.listAllOrder(customerid);
request.setAttribute("orders", orders);
return mapping.findForward("return");
} catch (OrderServiceException e) {
//客户还没有下订单
request.setAttribute("error",e.getMessage());
return mapping.findForward("failure");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -