KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > olstore > action > ItemDispatchActions


1 /**
2  * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17  * USA
18  *
19  * Component of: Red Hat Application Server
20  *
21  * Initial Developers: Aizaz Ahmed
22  * Vivek Lakshmanan
23  * Andrew Overholt
24  * Matthew Wringe
25  *
26  */

27 package olstore.action;
28
29 import javax.servlet.http.*;
30 import org.apache.struts.action.*;
31
32
33 public class ItemDispatchActions extends DemoBaseDispatchActions {
34
35     /**
36      * This method forwards to the success page which should represent
37      * an item for editing, if it already exists
38      */

39     public ActionForward view ( ActionMapping mapping,
40                                 ActionForm form,
41                                 HttpServletRequest request,
42                                 HttpServletResponse response
43                               ) throws Exception {
44
45         // Load up the item into the Dynamic Action form so that it
46
// displays on the success page
47
return mapping.findForward ( "createItem" );
48
49     }
50
51
52     /**
53      * This method is used to update or create an item with user
54      * entered information
55      */

56     public ActionForward update ( ActionMapping mapping,
57                                   ActionForm form,
58                                   HttpServletRequest request,
59                                   HttpServletResponse response
60                                 ) throws Exception {
61
62         // Load data from form into dto, and pass to session bean to
63
// either create or update the item (depending on if it has
64
// an itemId already or not
65

66         return mapping.findForward ( "createItem" );
67     }
68
69 }
70
Popular Tags