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