BAEL-112 | Spring MVC Validation - a Custom Validator (#934)

* BAEL-112 | Spring MVC Validation - a Custom Validator

### Implementation of a custom validator in Employee class using
Validator interface

* BAEL-112 | Spring MVC Validation - a Custom Validator

Implementation of a custom validator in Employee class using Validator
interface

* BAEL-112 | Spring MVC Validation - a Custom Validator

Reverting changes made for a previous module

* BAEL-112 | Spring MVC Validation - a Custom Validator

Reverting changes to module ‘spring-mvc-java’

* BAEL-112 | Spring MVC Validation - a Custom Validator

Reverting changes to module ‘spring-mvc-java’

* BAEL-112 | Spring MVC Validation - a Custom Validator

Final reversion of changes to previous module used

* BAEL-112 | Spring MVC Validation - a Custom Validator

formats the EmployeeValidator class

* BAEL-112 | Spring MVC Validation - a Custom Validator

Modification from @RequestMapping POST to @PostMapping as per Final
Review

* BAEL-112 | Spring MVC Validation - a Custom Validator

Reverts the changes made to Employee and Employee Controller. Created a
new class, Customer as implementation for custom validation

* BAEL-112 | Spring MVC Validation - a Custom Validator

Reverting EmployeeController

* BAEL-112 | Spring MVC Validation - a Custom Validator

Reverting EmployeeHome
This commit is contained in:
gatmeister
2017-01-15 06:49:14 +08:00
committed by Zeger Hendrikse
parent fa2f0159a9
commit 2b2dc447bf
5 changed files with 190 additions and 0 deletions
@@ -0,0 +1,47 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Form Example - Add Customer</title>
<style>
.error {
color: #ff0000;
font-weight: bold;
}
</style>
</head>
<body>
<h3>Welcome, Enter The Customer Details</h3>
<form:form method="POST" action="${pageContext.request.contextPath}/addCustomer" modelAttribute="customer">
<table>
<tr>
<td><form:label path="customerId">Customer Id</form:label></td>
<td><form:input path="customerId" /></td>
<td><form:errors path="customerId" cssClass="error" /></td>
</tr>
<tr>
<td><form:label path="customerName">Customer Name</form:label></td>
<td><form:input path="customerName" /></td>
<td><form:errors path="customerName" cssClass="error" /></td>
</tr>
<tr>
<td><form:label path="customerContact">Customer Contact</form:label></td>
<td><form:input path="customerContact"/></td>
<td><form:errors path="customerContact" cssClass="error" /></td>
</tr>
<tr>
<td><form:label path="customerEmail">Customer Email</form:label></td>
<td><form:input path="customerEmail" /></td>
<td><form:errors path="customerEmail" cssClass="error" /></td>
</tr>
<tr>
<td><input type="submit" value="Submit" /></td>
</tr>
</table>
</form:form>
</body>
</html>
@@ -0,0 +1,28 @@
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<html>
<head>
<title>Spring MVC Form Handling</title>
</head>
<body>
<h2>Submitted Customer Information</h2>
<table>
<tr>
<td>Customer Id :</td>
<td>${customerId}</td>
</tr>
<tr>
<td>Customer Name :</td>
<td>${customerName}</td>
</tr>
<tr>
<td>Customer Contact :</td>
<td>${customerContact}</td>
</tr>
<tr>
<td>Customer Email :</td>
<td>${customerEmail}</td>
</tr>
</table>
</body>
</html>