From 910368fc24e026ad461b751b47a5666cc2dbc0ce Mon Sep 17 00:00:00 2001 From: Iker Irazu Date: Thu, 12 Jan 2017 13:01:03 +0100 Subject: [PATCH 1/5] Add JSF dependencies --- pom.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pom.xml b/pom.xml index 5285ab1..b31f98a 100644 --- a/pom.xml +++ b/pom.xml @@ -21,6 +21,7 @@ UTF-8 UTF-8 1.8 + 2.2.14 @@ -58,6 +59,18 @@ javax.servlet jstl + + + + com.sun.faces + jsf-api + ${jsf.version} + + + com.sun.faces + jsf-impl + ${jsf.version} + From 13c83fd39d8d5a10545d7c9dca3add17a414d749 Mon Sep 17 00:00:00 2001 From: Iker Irazu Date: Thu, 12 Jan 2017 13:04:09 +0100 Subject: [PATCH 2/5] Add FacesServlet and faces-config.xml file with SpringBeanFacesELResolver --- src/main/webapp/WEB-INF/faces-config.xml | 5 +++++ src/main/webapp/WEB-INF/web.xml | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/main/webapp/WEB-INF/faces-config.xml create mode 100644 src/main/webapp/WEB-INF/web.xml diff --git a/src/main/webapp/WEB-INF/faces-config.xml b/src/main/webapp/WEB-INF/faces-config.xml new file mode 100644 index 0000000..b20a905 --- /dev/null +++ b/src/main/webapp/WEB-INF/faces-config.xml @@ -0,0 +1,5 @@ + + + org.springframework.web.jsf.el.SpringBeanFacesELResolver + + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..7add154 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,13 @@ + + + + + FacesServlet + javax.faces.webapp.FacesServlet + + + \ No newline at end of file From d20986fb3cf7c809b50ff5dbd15aae82a5496492 Mon Sep 17 00:00:00 2001 From: Iker Irazu Date: Thu, 12 Jan 2017 13:04:29 +0100 Subject: [PATCH 3/5] Add configuration for sf --- src/main/java/eu/arima/JSFConfiguration.java | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/main/java/eu/arima/JSFConfiguration.java diff --git a/src/main/java/eu/arima/JSFConfiguration.java b/src/main/java/eu/arima/JSFConfiguration.java new file mode 100644 index 0000000..0b05c3a --- /dev/null +++ b/src/main/java/eu/arima/JSFConfiguration.java @@ -0,0 +1,27 @@ +package eu.arima; + +import javax.faces.webapp.FacesServlet; + +import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.sun.faces.config.ConfigureListener; + +@Configuration +public class JSFConfiguration { + + @Bean + public ServletRegistrationBean facesServletRegistration() { + ServletRegistrationBean registration = new ServletRegistrationBean(new FacesServlet(), "*.xhtml"); + registration.setName("FacesServlet"); + registration.setLoadOnStartup(1); + return registration; + } + + @Bean + public ServletListenerRegistrationBean jsfConfigureListener() { + return new ServletListenerRegistrationBean(new ConfigureListener()); + } +} From c9482471897cb0b5438aa78826d1fd34a823c0d3 Mon Sep 17 00:00:00 2001 From: Iker Irazu Date: Thu, 12 Jan 2017 13:05:03 +0100 Subject: [PATCH 4/5] Create bean for sf --- src/main/java/eu/arima/beans/JsfBean.java | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/main/java/eu/arima/beans/JsfBean.java diff --git a/src/main/java/eu/arima/beans/JsfBean.java b/src/main/java/eu/arima/beans/JsfBean.java new file mode 100644 index 0000000..f6e9421 --- /dev/null +++ b/src/main/java/eu/arima/beans/JsfBean.java @@ -0,0 +1,30 @@ +package eu.arima.beans; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.stereotype.Service; + +@Service +public class JsfBean { + + private String message; + + private List list; + + public JsfBean() { + this.message = "Hello Arima!!!"; + this.list = new ArrayList<>(); + for (int i = 0; i < 10; i++) { + this.list.add("Message " + i); + } + } + + public String getMensaje() { + return this.message; + } + + public List getList() { + return this.list; + } +} From 97b586cd1a0ec029d9ef7b7f28c996bc86ef23ea Mon Sep 17 00:00:00 2001 From: Iker Irazu Date: Thu, 12 Jan 2017 13:05:16 +0100 Subject: [PATCH 5/5] Add hello.xhtml --- src/main/webapp/jsf/hello.xhtml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/webapp/jsf/hello.xhtml diff --git a/src/main/webapp/jsf/hello.xhtml b/src/main/webapp/jsf/hello.xhtml new file mode 100644 index 0000000..298a25c --- /dev/null +++ b/src/main/webapp/jsf/hello.xhtml @@ -0,0 +1,21 @@ + + + + Login + + + +

+ +

+ + + +
+
+ +
+ + \ No newline at end of file