Client side java script validation using struts validation framework

Welcome to Toppersarena.com Forums Computer Language Arena Client side java script validation using struts validation framework

This topic contains 0 replies, has 0 voices, and was last updated by Admin admin 5 years, 9 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1852
    Admin
    admin
    Keymaster

    Client side java script validation using struts validation framework

    The struts validation framework also provide you to validate form data on client side using JavaScript without writing a single line of java script code, the struts validation framework generates the JavaScript code for you. In this example we will see how we can achieve client side JavaScript validation using struts validation framework.

    We will take up our registration application example for validation framework tutorial, we saw in last tutorial that registration form bean class has been configure inside validation.xml for validation, the validation.xml file look like below code.


























    minlength
    7


    To enable the client side javascript validation you need to put the struts html tag library’s javascript tag in each JSP page where your form bean has been defined. This tag will take one attribute named formName, you need to pass the form name same as defined in struts configuration file.

    In registration.jsp page we will update the code to for client side java script validation, after updating the register.jsp page looks like below code.

    < %@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
    < %@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>



    Select
    Male
    Female
    Submit Reset

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.