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 import jakarta.servlet.http.HttpServletRequest;
25 import jakarta.servlet.http.HttpServletResponse;
26
27 import org.apache.struts.action.Action;
28 import org.apache.struts.action.ActionForm;
29 import org.apache.struts.action.ActionForward;
30 import org.apache.struts.action.ActionMapping;
31 import org.apache.struts.action.DynaActionForm;
32
33 public class DynaSetAction extends Action {
34 private static final long serialVersionUID = -5444845242354992905L;
35
36 public ActionForward execute(ActionMapping mapping,
37 ActionForm form,
38 HttpServletRequest request,
39 HttpServletResponse response)
40 throws Exception {
41
42 DynaActionForm dynaActionForm = (DynaActionForm) form;
43
44 dynaActionForm.set("foo", "alpha");
45 dynaActionForm.set("bar", "beta");
46
47 return (mapping.findForward("success"));
48 }
49 }