1
2
3
4
5
6
7
8
9
10 package nl.openedge.baritus.test;
11
12 import nl.openedge.baritus.FormBeanContext;
13 import nl.openedge.baritus.validation.AbstractFormValidator;
14
15 import org.infohazard.maverick.flow.ControllerContext;
16
17 /***
18 * @author hillenius
19 */
20 public class TestFormValidator1 extends AbstractFormValidator
21 {
22
23 /***
24 * @param cctx
25 * @param formBeanContext
26 * @return
27 * @see nl.openedge.baritus.validation.FormValidator#isValid(org.infohazard.maverick.flow.ControllerContext, nl.openedge.baritus.FormBeanContext)
28 */
29 public boolean isValid(
30 ControllerContext cctx,
31 FormBeanContext formBeanContext)
32 {
33 boolean valid = true;
34 TestBean bean = (TestBean)formBeanContext.getBean();
35
36
37 if(bean.getToValidate4().equals("kill"))
38 {
39 throw new RuntimeException("big mistake");
40 }
41
42 valid = bean.getToValidate4().equals("validValue");
43 if(!valid)
44 {
45 formBeanContext.setError("toValidate4", "wrong input");
46 }
47
48 return valid;
49 }
50
51 }