The first time the page is visited, all fields are blank.
When the Register button is clicked, the values currently in the fields are saved to variables (which are declared at the beginning of the content section of the JSP).
Listing 1 shows the code for the form as it appears in content_register Form from Registration page of Code tag at the top of Listing 1, the on Submit attribute calls a validate() method, which does the checking to see whether the form fields are valid.
If validate() returns false, the submit action will be canceled.
The template to which a field must conform can be as simple as, "this field cannot be blank." But validation can also be much more complex.
Validation can check a field to see whether it is identical to another field (as in "password" and "confirm password" fields), that they meet minimums or maximums for length or numerical value, or even that they conform to a complex regular expression.
The Code Notes Web site uses forms validation on several pages.
In this article, we will use the New User Registration page to demonstrate validation in JSP and ASP. The registration page is a simple form with six fields, a checkbox, and a button.
In this article, we will briefly demonstrate how validation is accomplished in a JSP page, and then convert that page to ASP. NET validation controls can greatly simplify the process of validating form data.
Its validation requirements are equally as simple: If either of these rules is broken, a message is displayed near the top of the page listing the invalid fields and what they require.
Note that validation only occurs when the Register button is clicked.
Microsoft Corporation October 2003 Applies to Microsoft® ASP. If a Submit button is pressed and one or more of the fields is incorrect, the field is considered invalid and a message appears on the page to indicate this.
(14 printed pages) Introduction Validation in JSP Converting JSP to ASP. NET In a Web application, is the process of determining whether text typed into a field or fields conforms to a certain template.