1
2
3
4
5 package hu.elte.tribus.form;
6
7 import javax.servlet.http.HttpServletRequest;
8
9 import org.apache.struts.action.ActionError;
10 import org.apache.struts.action.ActionErrors;
11 import org.apache.struts.action.ActionForm;
12 import org.apache.struts.action.ActionMapping;
13
14 /***
15 * MyEclipse Struts
16 * Creation date: 11-11-2006
17 *
18 * XDoclet definition:
19 * @struts.form name="qaForm"
20 */
21 public class QaForm extends ActionForm {
22
23
24
25
26 /*** answer property */
27 private String answer;
28
29 /*** question property */
30 private String question;
31
32 private int topic;
33
34
35
36
37
38 /***
39 * Method validate
40 * @param mapping
41 * @param request
42 * @return ActionErrors
43 */
44 public ActionErrors validate(ActionMapping mapping,
45 HttpServletRequest request) {
46 ActionErrors errors = new ActionErrors();
47 if(getQuestion().equals(""))
48 {
49 errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.question.empty"));
50 }
51 if(getAnswer().equals(""))
52 {
53 errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.answer.empty"));
54 }
55 if(errors.size() == 0)
56 {
57 return null;
58 }
59 else
60 {
61
62 return null;
63 }
64 }
65
66 /***
67 * Method reset
68 * @param mapping
69 * @param request
70 */
71 public void reset(ActionMapping mapping, HttpServletRequest request) {
72
73 }
74
75 /***
76 * Returns the answer.
77 * @return String
78 */
79 public String getAnswer() {
80 return answer;
81 }
82
83 /***
84 * Set the answer.
85 * @param answer The answer to set
86 */
87 public void setAnswer(String answer) {
88 this.answer = answer;
89 }
90
91 /***
92 * Returns the question.
93 * @return String
94 */
95 public String getQuestion() {
96 return question;
97 }
98
99 /***
100 * Set the question.
101 * @param question The question to set
102 */
103 public void setQuestion(String question) {
104 this.question = question;
105 }
106
107 public int getTopic() {
108 return topic;
109 }
110
111 public void setTopic(int topic) {
112 this.topic = topic;
113 }
114 }