1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package examples.multibox;
23
24 import javax.servlet.http.HttpServletRequest;
25
26 import org.apache.struts.action.ActionErrors;
27 import org.apache.struts.action.ActionForm;
28 import org.apache.struts.action.ActionMapping;
29
30 /**
31 * An ActionForm for the Multibox examples
32 *
33 * @version $Rev: 471754 $ $Date: 2006-11-06 08:55:09 -0600 (Mon, 06 Nov 2006) $
34 */
35 public class MultiboxActionForm extends ActionForm {
36
37
38
39 /** Fruits */
40 private String[] fruits = {};
41
42 /** Colors */
43 private String[] colors = {};
44
45
46
47 /**
48 * Constructor for MultiboxActionForm.
49 */
50 public MultiboxActionForm() {
51 super();
52 }
53
54
55
56 /**
57 * Clear all checkboxes
58 *
59 * @param mapping The mapping used to select this instance
60 * @param request The servlet request we are processing
61 */
62 public void reset(ActionMapping mapping, HttpServletRequest request) {
63
64
65
66
67
68
69 String[] empty = {};
70 this.fruits = empty;
71 this.colors = empty;
72
73 }
74
75 /**
76 * Validate the properties that have been set from this HTTP request,
77 * and return an <code>ActionMessages</code> object that encapsulates any
78 * validation errors that have been found. If no errors are found, return
79 * <code>null</code> or an <code>ActionMessages</code> object with no
80 * recorded error messages.
81 *
82 * @param mapping The mapping used to select this instance
83 * @param request The servlet request we are processing
84 *
85 * @return ActionMessages if any validation errors occurred
86 */
87 public ActionErrors validate(
88 ActionMapping mapping,
89 HttpServletRequest request) {
90
91
92
93
94
95
96
97 return null;
98 }
99
100
101
102 /**
103 * Returns the colors.
104 * @return String[]
105 */
106 public String[] getColors() {
107 return colors;
108 }
109
110 /**
111 * Returns the fruits.
112 * @return String[]
113 */
114 public String[] getFruits() {
115 return fruits;
116 }
117
118 /**
119 * Sets the colors.
120 * @param colors The colors to set
121 */
122 public void setColors(String[] colors) {
123 this.colors = colors;
124 }
125
126 /**
127 * Sets the fruits.
128 * @param fruits The fruits to set
129 */
130 public void setFruits(String[] fruits) {
131 this.fruits = fruits;
132 }
133
134 }