/
pavelsamodurov
/
financejavaee216
Обзор
Документация
Войти
/
pavelsamodurov
/
financejavaee216
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
financejavaee-web/src/main/java/com/testproject/view/CustomerView.java
54 строки
1 KB
Pavel Samodurov
add customer page with table and with form for adding new customer
26 фев 2020, 21:27
26 фев 2020, 21:27
b7c415d
Код
Авторство
О чём код?
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.testproject.view; import com.testproject.facade.CustomerFacadeLocal; import com.testproject.model.Customer; import java.io.IOException; import javax.ejb.EJB; import javax.enterprise.context.RequestScoped; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import javax.inject.Named; import javax.servlet.http.HttpServletRequest; /** * * @author Pavel Samodurov ps07t447@gmail.com */ @Named @RequestScoped public class CustomerView { @EJB private CustomerFacadeLocal customerFacade; private String name; private String address; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public void save() throws IOException { customerFacade.create(new Customer(name, address)); ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); ec.redirect(((HttpServletRequest) ec.getRequest()).getRequestURI()); } }