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.validator;
23
24 import javax.servlet.http.HttpServletRequest;
25 import javax.servlet.http.HttpServletResponse;
26
27 import java.util.ArrayList;
28 import org.apache.commons.logging.Log;
29 import org.apache.commons.logging.LogFactory;
30 import org.apache.struts.action.Action;
31 import org.apache.struts.action.ActionForm;
32 import org.apache.struts.action.ActionForward;
33 import org.apache.struts.action.ActionMapping;
34 import org.apache.struts.util.LabelValueBean;
35
36
37
38
39
40 public final class EditTypeAction extends Action {
41
42
43
44
45 private Log log = LogFactory.getFactory().getInstance(this.getClass().getName());
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62 public ActionForward execute(
63 ActionMapping mapping,
64 ActionForm form,
65 HttpServletRequest request,
66 HttpServletResponse response)
67 throws Exception {
68
69
70
71 initFormBeans(mapping, form, request);
72
73 return mapping.findForward("success");
74 }
75
76
77
78
79
80
81 protected void initFormBeans(
82 ActionMapping mapping, ActionForm form,
83 HttpServletRequest request) {
84
85 log.debug("initFromBeans");
86
87
88 ArrayList satisfactionList = new ArrayList();
89 satisfactionList.add(new LabelValueBean("Very Satisfied", "4"));
90 satisfactionList.add(new LabelValueBean("Satisfied", "3"));
91 satisfactionList.add(new LabelValueBean("Not Very Satisfied", "2"));
92 satisfactionList.add(new LabelValueBean("Not Satisfied", "1"));
93 request.setAttribute("satisfactionList", satisfactionList);
94
95 ArrayList osTypes = new ArrayList();
96 osTypes.add(new LabelValueBean("Mac OsX", "OsX"));
97 osTypes.add(new LabelValueBean("Windows 95/98/Me", "Win32"));
98 osTypes.add(new LabelValueBean("Windows NT/2000/XP/2003", "WinNT"));
99 osTypes.add(new LabelValueBean("Linux", "Linux"));
100 osTypes.add(new LabelValueBean("BSD NetBSD/FreeBSD/OpenBSD", "BSD"));
101 request.setAttribute("osTypes", osTypes);
102
103 ArrayList languageTypes = new ArrayList();
104 languageTypes.add(new LabelValueBean("C++", "C++"));
105 languageTypes.add(new LabelValueBean("C#", "C#"));
106 languageTypes.add(new LabelValueBean("Java", "java"));
107 languageTypes.add(new LabelValueBean("Smalltalk", "Smalltalk"));
108 request.setAttribute("languageTypes", languageTypes);
109 }
110 }