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