FileDocCategorySizeDatePackage
ViewOrderAction.javaAPI DocExample1083Thu Dec 04 08:19:26 GMT 2003org.springframework.samples.jpetstore.web.struts

ViewOrderAction

public class ViewOrderAction extends SecureBaseAction

Fields Summary
Constructors Summary
Methods Summary
protected org.apache.struts.action.ActionForwarddoExecute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

    AccountActionForm acctForm = (AccountActionForm) form;
    int orderId = Integer.parseInt(request.getParameter("orderId"));
    Order order = getPetStore().getOrder(orderId);
    if (acctForm.getAccount().getUsername().equals(order.getUsername())) {
      request.setAttribute("order", order);
      return mapping.findForward("success");
    }
		else {
      request.setAttribute("message", "You may only view your own orders.");
      return mapping.findForward("failure");
    }