EditAccountFormAction.java
Upload User: jiancairen
Upload Date: 2007-08-27
Package Size: 26458k
Code Size: 1k
Category:

Java Develop

Development Platform:

Java

  1. package org.springframework.samples.jpetstore.web.struts;
  2. import java.util.List;
  3. import javax.servlet.http.HttpServletRequest;
  4. import javax.servlet.http.HttpServletResponse;
  5. import org.apache.struts.action.ActionForm;
  6. import org.apache.struts.action.ActionForward;
  7. import org.apache.struts.action.ActionMapping;
  8. import org.springframework.samples.jpetstore.domain.Account;
  9. public class EditAccountFormAction extends SecureBaseAction {
  10.   protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
  11.     AccountActionForm workingAcctForm = (AccountActionForm) form;
  12.     AccountActionForm acctForm = (AccountActionForm) request.getSession().getAttribute("accountForm");
  13.     String username = acctForm.getAccount().getUsername();
  14.     if (workingAcctForm.getAccount() == null) {
  15.       Account account = getPetStore().getAccount(username);
  16.       workingAcctForm.setAccount(account);
  17.     }
  18.     if (workingAcctForm.getCategories() == null) {
  19.       List categories = getPetStore().getCategoryList();
  20.       workingAcctForm.setCategories(categories);
  21.     }
  22.     return mapping.findForward("success");
  23.   }
  24. }