01: /**
02: * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or any later version.
08: *
09: * 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: */package olstore.action;
27:
28: import javax.servlet.http.*;
29: import org.apache.struts.action.*;
30:
31: public class ItemDispatchActions extends DemoBaseDispatchActions {
32:
33: /**
34: * This method forwards to the success page which should represent
35: * an item for editing, if it already exists
36: */
37: public ActionForward view(ActionMapping mapping, ActionForm form,
38: HttpServletRequest request, HttpServletResponse response)
39: throws Exception {
40:
41: // Load up the item into the Dynamic Action form so that it
42: // displays on the success page
43: return mapping.findForward("createItem");
44:
45: }
46:
47: /**
48: * This method is used to update or create an item with user
49: * entered information
50: */
51: public ActionForward update(ActionMapping mapping, ActionForm form,
52: HttpServletRequest request, HttpServletResponse response)
53: throws Exception {
54:
55: // Load data from form into dto, and pass to session bean to
56: // either create or update the item (depending on if it has
57: // an itemId already or not
58:
59: return mapping.findForward("createItem");
60: }
61:
62: }
|