Monday, March 14, 2016

HOW TO USE SPRINGFORM:ERROR TAG

To use Spring Form Error Tag, you have to follow following steps.

Your JSP Page should look like this:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>About Us Page</title>
    </head>
    <body>      
        <sf:form method="POST" action ="/SpringBasics/redirect.aspx" modelAttribute="basicClass">
            FirstName: <sf:input path="firstName" />
            <sf:errors path="firstName" />
        <br/>
            <input type="submit" value="Redirect Page" />    
        </sf:form>
    </body>
</html>