View web.xml
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<welcome-file-list>
<welcome-file>new-employee.html</welcome-file>
</welcome-file-list>
View EmployeeController.java
package com.arthurportas.presentation.servlets;
import com.arthurportas.entities.Employee;
import com.arthurportas.services.EmployeeService;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
View new-employee.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>::StaffGest:: - new-employee</title>
<meta name="description" content="StaffGest:: - search-employee">
<meta name="author" content="Arthur Portas">
</head>
<body>
View new-employee.ftl
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>New Employee</title>
</head>
<body>
Employee created with success!
${emp}
</body>
View search-employee.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>::StaffGest:: - search-employee</title>
<meta name="description" content="StaffGest:: - search-employee">
<meta name="author" content="Arthur Portas">
</head>
<body>
View search-employee.ftl
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Search Employee</title>
</head>
<body>
Search results: ${emp}
</body>
</html>
View EmployeeDaoUT.java
package unittests;
import com.arthurportas.persistence.daos.EmployeeDaoImpl;
import com.arthurportas.persistence.entities.Employee;
import com.github.javafaker.Faker;
import org.apache.commons.lang3.StringUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
View EmployeeDaoImpl.java
package com.arthurportas.persistence.daos;
import com.arthurportas.persistence.entities.Employee;
import java.util.List;
/**
* Created by arthurportas on 10/05/2017.
*/
public class EmployeeDaoImpl extends GenericDaoImpl<Employee> implements EmployeeDaoCustom<Employee> {
View EmployeeDaoCustom.java
package com.arthurportas.persistence.daos;
import java.util.List;
/**
* Created by arthurportas on 10/05/2017.
*/
public interface EmployeeDaoCustom<Employee> {
List<Employee> findByName(String pattern);
View GenericDaoImpl.java
package com.arthurportas.persistence.daos;
import com.arthurportas.persistence.PersistenceEnum;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;
/**
* Created by arthurportas on 14/05/2017.
*/