Form Validation in Struts Application – Struts Tutorial

Form validation in Struts Application:-

Proto type of validate () method:-

       Form1:-  Public ActionErrors validate (ActionMapping mapping, HttpServletRequest request)

       Form2:-  Public ActionErrors validate (ActionMapping mapping, ServletRequest request)

                    Form1 validate () method is recommended.

  • ActionError class object is internally map data Structure it contains elements representing form validation errors.
  • When validate () of form bean class returns ActionErrors class object without elements (size is zero) (indicates no form validation errors) then ActionServlet transfors control to the execute () method of Action class.
  • If validate () method of form bean class returns ActionError class object with elements (size is > 0) (indicates form validation errors are there) then ActionServlet transfers the control to input jsp to display form validation error messages.

Leave a Reply

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