Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Backing Bean for Employee
package com.arthurportas.presentation.backingbeans;
import com.arthurportas.entities.Employee;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;
* Created by arthurportas on 29/04/2017.
public class EmployeeBean implements Serializable {
private String firstName;
private String lastName;
private Employee employee;
private String value;
public String getFirstName() {
return firstName;
public void setFirstName(String firstName) {
this.firstName = firstName;
public String getLastName() {
return lastName;
public void setLastName(String lastName) {
this.lastName = lastName;
public Employee getEmployee() {
return employee;
public void setEmployee(Employee employee) {
this.employee = employee;
public String getValue() {
return value;
public void setValue(String value) {
this.value = value;
public String save() {
Employee employee = new Employee();
this.employee = getEmployeeService().create(employee);
return "new-employee-result.xhtml";
public String search() {
this.employee = getEmployeeService().findbyName(this.value);
return "search-employee-result.xhtml";
private EmployeeService getEmployeeService() {
return new EmployeeService();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment