Display Form Validation Errors with Respect to the Position of their Form Components

Question:-  How to display form validation errors with respect to the position of their form components?

step1:- Remove <ul> tag, <li> tag effects from properties file.

In myfile.properties:-

            # to apply style on Form validation error messages

             Errors.header = <font color = blue size = 1>

            Errors.footer = </font>

Step2:- use <html: errors> tag with properties attribute as shown below in the input page of Action class.                

Reg.jsp:-

         <%@

          <%@

          <%@

           <html: form action = “register” method = “get”>

             Username: <html: text property = “username”/> <html: errors property = “unerr”/><br>

             Password: <html: password property = “password”/> <html: errors property = “pwderr”/><br>

             <html: submit value = “checkDetails”/>

             </html: form>

  • Logical names given for form validations while adding them as elements of ActionErrors class object in the validate (-,-) of method of form bean class refer step: (3) of previous class.

Leave a Reply

Your email address will not be published. Required fields are marked *