KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xpetstore > web > struts > action > customer > MyAccountAction


1 package xpetstore.web.struts.action.customer;
2
3 import javax.servlet.http.HttpServletRequest JavaDoc;
4 import javax.servlet.http.HttpServletResponse JavaDoc;
5
6 import org.apache.struts.action.ActionForm;
7 import org.apache.struts.action.ActionForward;
8 import org.apache.struts.action.ActionMapping;
9
10 import xpetstore.domain.customer.ejb.Customer;
11
12 import xpetstore.web.struts.action.BaseAction;
13
14
15 /**
16  * @author <a HREF="mailto:tchbansi@sourceforge.net">Herve Tchepannou</a>
17  *
18  * @struts.action
19  * name="customerForm"
20  * path="/myaccount"
21  * scope="request"
22  * validate="false"
23  *
24  * @struts.action-forward
25  * name="success"
26  * path="/myaccount.jsp"
27  */

28 public class MyAccountAction
29     extends BaseAction
30 {
31     //~ Methods ----------------------------------------------------------------
32

33     /**
34      * @see xpetstore.web.struts.action.BaseAction#doExecute(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse)
35      */

36     protected ActionForward doExecute( ActionMapping mapping,
37                                        ActionForm form,
38                                        HttpServletRequest JavaDoc request,
39                                        HttpServletResponse JavaDoc response )
40         throws Exception JavaDoc
41     {
42         CustomerForm frm = ( CustomerForm ) form;
43         String JavaDoc userId = ( String JavaDoc ) request.getSession( ).getAttribute( USERID_KEY );
44
45         Customer cst = getPetstore( ).getCustomer( userId );
46         frm.setCustomer( cst );
47
48         return mapping.findForward( SUCCESS );
49     }
50 }
51
Popular Tags