API Overview API Index Package Overview Direct link to this page
JavaOnTracks 0.1.2
  net.jot.web.ctrl. JOTFormValidationController View Javadoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

/*
------------------------------------
JavaOnTracks          Thibaut Colar
tcolar-jot AT colar DOT net
Artistic Licence 2.0
http://www.javaontracks.net
------------------------------------
 */
package net.jot.web.ctrl;

import java.util.Hashtable;

import net.jot.logger.JOTLogger;
import net.jot.web.forms.JOTForm;

/**
 * Generic class you can extend to create a formValidation Controller
 * @author thibautc
 */
public abstract class JOTFormValidationController extends JOTController
{
	private String result=RESULT_FAILURE;
	
        /**
         * Calls the form validate() method
         * @param form
         * @return
         */
	public Hashtable validateForm(JOTForm form)
	{
		Hashtable result=new Hashtable();
		try
		{
			result=form.validate(request);
			if(result.size()==0)
				this.result=RESULT_SUCCESS;
		}
		catch(Exception e)
		{
			JOTLogger.logException(JOTLogger.CAT_FLOW, JOTLogger.ERROR_LEVEL, this, "Form validation failed! ",e);
		}
		return result;
	}

        /**
         * Returns the form validation results.
         * @return
         * @throws java.lang.Exception
         */
	public String process() throws Exception
	{
		return result;
	}
}

Generated By: JavaOnTracks Doclet 0.1.5     ©Thibaut Colar