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} + 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()); + } +} 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; + } +} 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 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