package com.ibatis.jpetstore.presentation.action;

import com.ibatis.jpetstore.presentation.form.*;
import org.apache.struts.action.*;

import javax.servlet.http.*;

public class ListOrdersAction extends SecureBaseAction {

  /* Public Methods */

  public ActionForward doPerform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

    AccountForm acctForm = (AccountForm) form;
    String username = acctForm.getAccount().getUsername();

    request.setAttribute("orderList", petStore.getOrdersByUsername(username));

    return mapping.findForward("success");
  }

}
