1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.apache.struts.webapp.el.exercise;
23
24
25 import org.apache.struts.action.Action;
26 import org.apache.struts.action.ActionForm;
27 import org.apache.struts.action.ActionForward;
28 import org.apache.struts.action.ActionMapping;
29
30 import javax.servlet.http.HttpServletRequest;
31 import javax.servlet.http.HttpServletResponse;
32
33
34 /**
35 * Do-nothing action that accepts the changes made automatically in our form
36 * bean, and then returns control to the input form (if "Save" was pressed) or
37 * the main menu (if "Cancel" was pressed).
38 *
39 * @author Craig R. McClanahan
40 * @version $Rev: 471754 $ $Date: 2004-12-08 00:11:35 -0500 (Wed, 08 Dec 2004)
41 * $
42 */
43
44 public class HtmlSettersAction extends Action {
45
46
47 /**
48 * Forward to the input form if "Save" was pressed or the main menu if
49 * "Cancel" was pressed.
50 *
51 * @param mapping The ActionMapping used to select this instance
52 * @param actionForm The optional ActionForm bean for this request
53 * @param request The servlet request we are processing
54 * @param response The servlet response we are creating
55 * @throws Exception if business logic throws an exception
56 */
57 public ActionForward execute(ActionMapping mapping,
58 ActionForm form,
59 HttpServletRequest request,
60 HttpServletResponse response)
61 throws Exception {
62
63 if (isCancelled(request)) {
64 return (mapping.findForward("index"));
65 } else {
66 return (mapping.findForward("input"));
67 }
68
69 }
70
71
72 }