diff --git a/jsf/pom.xml b/jsf/pom.xml index ae97a71244..e58e61de7f 100644 --- a/jsf/pom.xml +++ b/jsf/pom.xml @@ -73,6 +73,13 @@ provided ${javax.servlet.version} + + + + org.primefaces + primefaces + 6.2 + @@ -103,6 +110,6 @@ 2.6 - + \ No newline at end of file diff --git a/jsf/src/main/java/com/baeldung/springintegration/controllers/HelloPFBean.java b/jsf/src/main/java/com/baeldung/springintegration/controllers/HelloPFBean.java new file mode 100644 index 0000000000..657ae37dd5 --- /dev/null +++ b/jsf/src/main/java/com/baeldung/springintegration/controllers/HelloPFBean.java @@ -0,0 +1,120 @@ +package com.baeldung.springintegration.controllers; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.el.ELContextEvent; +import javax.el.ELContextListener; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +@ManagedBean(name = "helloPFBean") +@ViewScoped +public class HelloPFBean { + + private String firstName; + private String lastName; + + private String componentSuite; + + private List technologies; + + private String inputText; + private String outputText; + + @PostConstruct + public void init() { + firstName = "Hello"; + lastName = "Primefaces"; + + technologies = new ArrayList(); + + Technology technology1 = new Technology(); + technology1.setCurrentVersion("10"); + technology1.setName("Java"); + + technologies.add(technology1); + + Technology technology2 = new Technology(); + technology2.setCurrentVersion("5.0"); + technology2.setName("Spring"); + + technologies.add(technology2); + } + + public void onBlurEvent() { + outputText = inputText.toUpperCase(); + } + + 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 String getComponentSuite() { + return componentSuite; + } + + public void setComponentSuite(String componentSuite) { + this.componentSuite = componentSuite; + } + + public List getTechnologies() { + return technologies; + } + + public void setTechnologies(List technologies) { + this.technologies = technologies; + } + + public String getInputText() { + return inputText; + } + + public void setInputText(String inputText) { + this.inputText = inputText; + } + + public String getOutputText() { + return outputText; + } + + public void setOutputText(String outputText) { + this.outputText = outputText; + } + + public class Technology { + private String name; + private String currentVersion; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCurrentVersion() { + return currentVersion; + } + + public void setCurrentVersion(String currentVersion) { + this.currentVersion = currentVersion; + } + + } + +} diff --git a/jsf/src/main/java/com/baeldung/springintegration/controllers/HelloPFMBean.java b/jsf/src/main/java/com/baeldung/springintegration/controllers/HelloPFMBean.java new file mode 100644 index 0000000000..4f2263353d --- /dev/null +++ b/jsf/src/main/java/com/baeldung/springintegration/controllers/HelloPFMBean.java @@ -0,0 +1,28 @@ +package com.baeldung.springintegration.controllers; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name = "helloPFMBean") +@SessionScoped +public class HelloPFMBean { + + private String magicWord; + + public String getMagicWord() { + return magicWord; + } + + public void setMagicWord(String magicWord) { + this.magicWord = magicWord; + } + + public String go() { + if (this.magicWord != null && this.magicWord.toUpperCase() + .equals("BAELDUNG")) { + return "pm:success"; + } + return "pm:failure"; + } + +} diff --git a/jsf/src/main/webapp/WEB-INF/faces-config.xml b/jsf/src/main/webapp/WEB-INF/faces-config.xml index e9e6404b95..af41904e34 100644 --- a/jsf/src/main/webapp/WEB-INF/faces-config.xml +++ b/jsf/src/main/webapp/WEB-INF/faces-config.xml @@ -25,6 +25,12 @@ org.springframework.web.jsf.el.SpringBeanFacesELResolver + + + org.primefaces.mobile.application.MobileNavigationHandler + + + diff --git a/jsf/src/main/webapp/pf_intro.xhtml b/jsf/src/main/webapp/pf_intro.xhtml new file mode 100644 index 0000000000..591aa7dad2 --- /dev/null +++ b/jsf/src/main/webapp/pf_intro.xhtml @@ -0,0 +1,59 @@ + + + + + + Hello Primefaces + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jsf/src/main/webapp/pfm_intro.xhtml b/jsf/src/main/webapp/pfm_intro.xhtml new file mode 100644 index 0000000000..1dd5d77e37 --- /dev/null +++ b/jsf/src/main/webapp/pfm_intro.xhtml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file