forms work and cleanup

This commit is contained in:
eugenp 2014-08-11 23:17:24 +03:00
parent 16b56b6de2
commit 8118f458bc
5 changed files with 13 additions and 4 deletions

View File

@ -28,7 +28,7 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>

View File

@ -24,10 +24,11 @@ public class EmployeeController {
if (result.hasErrors()) {
return "error";
}
model.addAttribute("name", employee.getName());
model.addAttribute("contactNumber", employee.getContactNumber());
model.addAttribute("id", employee.getId());
return "employeeAdded";
return "employeeView";
}
}

View File

@ -1,9 +1,17 @@
package org.baeldung.spring.form;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
public class Employee {
private String name;
private long id;
@NotNull
@Size(min = 1)
private String name;
@NotNull
@Size(min = 1)
private String contactNumber;
public Employee() {

View File

@ -3,7 +3,7 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SpringMVCExample</title>
<title>Form Example - Register an Employee</title>
</head>
<body>
<h3>Welcome, Enter The Employee Details</h3>