jWebForm
A simple framework for validating HTML form parameters

jWebForm consists of 3 thingys: a servlet (DoJWebForm), a base class (jWebForm), and a class for encapsulating validation logic (vtor). This is a simple framework, but the supporting technologies are not. Once you have the supporting platform configured and working, you are ready to try the jWebForm.

Using jWebForm

Usage of jWebForm is best illustrated by example. So, for example, we have a JSP called myForm and a javabean called myFormBean. myForm implements an HTML form; myFormBean is the javabean referenced in the tag of myForm.
myForm.jsp
myFormBean.java

First, extend your javabean with jWebForm, like so:

myFormBean : extends jWebForm

Then add some vtors, a URL for success, and a URL for failure.
The bean's constructor is a good place to do this:

myFormBean()
{
    super();
    addVtor("Name", "Name is a required field", V_REQUIRED);
    addVtor("ZipCode", "Hey! Zip Codes are numeric! Sheesh...", V_NUMERIC);
    setNextURL("/myThingy/myFormSuccess");
    setBoloURL("/servlet/myFormErr");
}

Upon submission, the form should go to an instance of the DoJWebForm servlet, or a derivitive thereof. jWebForm uses a single interface for retrieving error messages: getFieldError(String paramname). To process error messages, you will need a servlet. This servlet must have access to the same jWebForm instance as was used in the form. I use a JSP, and I copy the tag info from the form's JSP file to the error-handling JSP file, setting the 'CREATE' parameter to "no":
Click here to see the error-handling servlet



Requirements:

Getting jWebForm

download via http: jwebform.tar.gz


Last modified: Thu Mar 19 13:13:57 Eastern Standard Time 1999