initial commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package net.woggioni.jsf.playground;
|
||||
|
||||
//
|
||||
//@Configuration
|
||||
//class SpringCoreConfig {
|
||||
//
|
||||
// @Bean
|
||||
// public UserManagementDAO userManagementDAO() {
|
||||
// return new UserManagementDAOImpl();
|
||||
// }
|
||||
//
|
||||
//}
|
||||
//
|
||||
//@Slf4j
|
||||
//public class MainWebAppInitializer extends FacesInitializer implements WebApplicationInitializer {
|
||||
//
|
||||
// @Override
|
||||
// public void onStartup(Set<Class<?>> classes, ServletContext servletContext) throws ServletException {
|
||||
// super.onStartup(classes, servletContext);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Register and configure all Servlet container components necessary to power the web application.
|
||||
// */
|
||||
// @Override
|
||||
// public void onStartup(final ServletContext sc) throws ServletException {
|
||||
// log.info("MainWebAppInitializer.onStartup()");
|
||||
// sc.setInitParameter("javax.faces.FACELETS_SKIP_COMMENTS", "true");
|
||||
//
|
||||
// // Create the 'root' Spring application context
|
||||
// final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext();
|
||||
// root.register(SpringCoreConfig.class);
|
||||
// sc.addListener(new ContextLoaderListener(root));
|
||||
// }
|
||||
//
|
||||
//}
|
@@ -0,0 +1,83 @@
|
||||
package net.woggioni.jsf.playground.controllers;
|
||||
|
||||
import jakarta.el.ELContextListener;
|
||||
import jakarta.el.LambdaExpression;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.el.ELContextEvent;
|
||||
import jakarta.faces.application.Application;
|
||||
import jakarta.faces.application.FacesMessage;
|
||||
|
||||
import jakarta.faces.context.FacesContext;
|
||||
import jakarta.faces.view.ViewScoped;
|
||||
import jakarta.inject.Named;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Random;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Named("ELBean")
|
||||
@ViewScoped
|
||||
public class ELSampleBean implements Serializable {
|
||||
public static final String constantField = "THIS_IS_NOT_CHANGING_ANYTIME_SOON";
|
||||
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
private String pageDescription = "This page demos JSF EL Basics";
|
||||
private int pageCounter;
|
||||
private Random randomIntGen = new Random();
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
pageCounter = randomIntGen.nextInt();
|
||||
FacesContext.getCurrentInstance()
|
||||
.getApplication()
|
||||
.addELContextListener(new ELContextListener() {
|
||||
@Override
|
||||
public void contextCreated(ELContextEvent evt) {
|
||||
evt.getELContext()
|
||||
.getImportHandler()
|
||||
.importClass("net.woggioni.spring.jsf.controllers.ELSampleBean");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void save() {
|
||||
|
||||
}
|
||||
|
||||
public static String constantField() {
|
||||
return constantField;
|
||||
}
|
||||
|
||||
public void saveFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public Long multiplyValue(LambdaExpression expr) {
|
||||
Long theResult = (Long) expr.invoke(FacesContext.getCurrentInstance()
|
||||
.getELContext(), pageCounter);
|
||||
return theResult;
|
||||
}
|
||||
|
||||
public void saveByELEvaluation() {
|
||||
firstName = (String) evaluateEL("#{firstName.value}", String.class);
|
||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
FacesMessage theMessage = new FacesMessage("Name component Evaluated: " + firstName);
|
||||
theMessage.setSeverity(FacesMessage.SEVERITY_INFO);
|
||||
ctx.addMessage(null, theMessage);
|
||||
|
||||
}
|
||||
|
||||
private Object evaluateEL(String elExpression, Class<?> clazz) {
|
||||
Object toReturn = null;
|
||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
Application app = ctx.getApplication();
|
||||
toReturn = app.evaluateExpressionGet(ctx, elExpression, clazz);
|
||||
|
||||
return toReturn;
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
package net.woggioni.jsf.playground.controllers;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.faces.view.ViewScoped;
|
||||
import jakarta.inject.Named;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Named("helloPFBean")
|
||||
@ViewScoped
|
||||
public class HelloPFBean implements Serializable {
|
||||
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
|
||||
private String componentSuite;
|
||||
|
||||
private List<Technology> technologies;
|
||||
|
||||
private String inputText;
|
||||
private String outputText;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
firstName = "Hello";
|
||||
lastName = "Primefaces";
|
||||
|
||||
technologies = new ArrayList<Technology>();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@Data
|
||||
public class Technology {
|
||||
private String name;
|
||||
private String currentVersion;
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package net.woggioni.jsf.playground.controllers;
|
||||
|
||||
import jakarta.enterprise.context.SessionScoped;
|
||||
import jakarta.inject.Named;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@Named("helloPFMBean")
|
||||
@SessionScoped
|
||||
public class HelloPFMBean implements Serializable {
|
||||
|
||||
private String magicWord;
|
||||
|
||||
public String go() {
|
||||
if (this.magicWord != null && this.magicWord
|
||||
.equalsIgnoreCase("BAELDUNG")) {
|
||||
return "pm:success";
|
||||
}
|
||||
return "pm:failure";
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package net.woggioni.jsf.playground.controllers;
|
||||
|
||||
import jakarta.faces.context.FacesContext;
|
||||
import jakarta.faces.view.ViewScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Named;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.woggioni.jsf.playground.dao.UserManagementDAO;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Slf4j
|
||||
@Getter
|
||||
@Setter
|
||||
@Named("registration")
|
||||
@ViewScoped
|
||||
public class RegistrationBean implements Serializable {
|
||||
|
||||
// @ManagedProperty(value = "#{userManagementDAO}")
|
||||
@Inject
|
||||
transient private UserManagementDAO userDao;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String operationMessage;
|
||||
|
||||
@SneakyThrows
|
||||
public void createNewUser() {
|
||||
log.info("Creating new user");
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
boolean operationStatus = userDao.createUser(userName);
|
||||
context.isValidationFailed();
|
||||
if (operationStatus) {
|
||||
operationMessage = "User " + userName + " created";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package net.woggioni.jsf.playground.controllers;
|
||||
|
||||
import jakarta.enterprise.context.RequestScoped;
|
||||
import jakarta.inject.Named;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Named("user")
|
||||
@RequestScoped
|
||||
public class User {
|
||||
private String name;
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package net.woggioni.jsf.playground.dao;
|
||||
|
||||
public interface UserManagementDAO {
|
||||
|
||||
boolean createUser(String newUserData);
|
||||
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package net.woggioni.jsf.playground.dao;
|
||||
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@ApplicationScoped
|
||||
public class UserManagementDAOImpl implements UserManagementDAO {
|
||||
|
||||
private List<String> users;
|
||||
|
||||
@PostConstruct
|
||||
public void initUserList() {
|
||||
users = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createUser(String newUserData) {
|
||||
if (newUserData != null) {
|
||||
users.add(newUserData);
|
||||
log.info("User {} successfully created", newUserData);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public UserManagementDAOImpl() {
|
||||
}
|
||||
|
||||
}
|
5
src/main/resources/META-INF/beans.xml
Normal file
5
src/main/resources/META-INF/beans.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
|
||||
version="4.0">
|
||||
</beans>
|
17
src/main/resources/log4j2.xml
Normal file
17
src/main/resources/log4j2.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="WARN">
|
||||
<Properties>
|
||||
<Property name="logLevelProperty">${sys:logLevel:-info}</Property>
|
||||
</Properties>
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_ERR">
|
||||
<PatternLayout pattern="%d{HH:mm:ss,SSS} [%highlight{%p}] (%t) %c: %m%n%throwable{short}"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
|
||||
<Loggers>
|
||||
<Root level="ALL">
|
||||
<AppenderRef ref="Console" level="${logLevelProperty}"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
2
src/main/resources/logging.properties
Normal file
2
src/main/resources/logging.properties
Normal file
@@ -0,0 +1,2 @@
|
||||
org.apache.catalina.core.ContainerBase.[Catalina].level=INFO
|
||||
org.apache.catalina.core.ContainerBase.[Catalina].handlers=java.util.logging.ConsoleHandler
|
3
src/main/resources/messages.properties
Normal file
3
src/main/resources/messages.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
message.valueRequired = This value is required
|
||||
message.welcome = JSF | Playground
|
||||
label.saveButton = Save
|
2
src/main/webapp/WEB-INF/context.xml
Normal file
2
src/main/webapp/WEB-INF/context.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Context antiJARLocking="true" path="/accenture"/>
|
45
src/main/webapp/WEB-INF/faces-config.xml
Normal file
45
src/main/webapp/WEB-INF/faces-config.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
|
||||
<!-- =========== FULL CONFIGURATION FILE ================================== -->
|
||||
|
||||
<faces-config version="2.1"
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd">
|
||||
|
||||
<application>
|
||||
<resource-bundle>
|
||||
<base-name>
|
||||
messages
|
||||
</base-name>
|
||||
<var>
|
||||
msg
|
||||
</var>
|
||||
</resource-bundle>
|
||||
<resource-bundle>
|
||||
<base-name>
|
||||
constraints
|
||||
</base-name>
|
||||
<var>
|
||||
constraints
|
||||
</var>
|
||||
</resource-bundle>
|
||||
<!-- <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>-->
|
||||
<!-- <el-resolver>org.jboss.weld.module.web.el.WeldELResolver</el-resolver>-->
|
||||
<!-- <navigation-handler>-->
|
||||
<!-- org.primefaces.mobile.application.MobileNavigationHandler-->
|
||||
<!-- </navigation-handler>-->
|
||||
|
||||
<!-- <default-render-kit-id>PRIMEFACES_MOBILE</default-render-kit-id> -->
|
||||
</application>
|
||||
|
||||
<navigation-rule>
|
||||
<from-view-id>/*</from-view-id>
|
||||
<navigation-case>
|
||||
<from-outcome>home</from-outcome>
|
||||
<to-view-id>/index.xhtml</to-view-id>
|
||||
<redirect/>
|
||||
</navigation-case>
|
||||
</navigation-rule>
|
||||
|
||||
</faces-config>
|
8
src/main/webapp/WEB-INF/web.xml
Normal file
8
src/main/webapp/WEB-INF/web.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
|
||||
version="6.0">
|
||||
<listener>
|
||||
<listener-class>org.jboss.weld.module.web.servlet.WeldTerminalListener</listener-class>
|
||||
</listener>
|
||||
</web-app>
|
35
src/main/webapp/el3_intro.xhtml
Normal file
35
src/main/webapp/el3_intro.xhtml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:c="http://java.sun.com/jsp/jstl/core">
|
||||
<h:head>
|
||||
<title>Baeldung | Expression Language 3.0</title>
|
||||
</h:head>
|
||||
<h:body>
|
||||
<h:outputLabel id="valueLabel" for="valueOutput" value="Composite Lambda Evaluation:"/>
|
||||
<h:outputText id="valueOutput" value="#{(cube=(x->x*x*x);cube(4))}"/>
|
||||
<br/>
|
||||
<h:outputLabel id="staticLabel" for="staticFieldOutput" value="Static Field Output:"/>
|
||||
<h:outputText id="staticFieldOutput" value="#{ElBean.constantField}"/>
|
||||
<br/>
|
||||
<h:outputLabel id="avgLabel" for="avg" value="Average of Integer List Value:"/>
|
||||
<h:outputText id="avg" value="#{['1','2','3'].stream().average().get()}"/>
|
||||
<br/>
|
||||
<h:outputLabel id="lambdaLabel" for="lambdaPass" value="Passing Lambda Expressions:"/>
|
||||
<h:outputText id="lambdaPass" value="#{ELBean.multiplyValue(x->x*x*x)}"/>
|
||||
<br/>
|
||||
<c:set var='pageLevelNumberList' value="#{[1,2,3]}"/>
|
||||
<h:outputLabel id="avgPageVarLabel" for="avgPageVar" value="Average of Page-Level Integer List Value:"/>
|
||||
<h:outputText id="avgPageVar" value="#{pageLevelNumberList.stream().average().get()}"/>
|
||||
<br/>
|
||||
<h:panelGrid title="Data Structures" border="3" >
|
||||
<h:dataTable var="streamResult" value="#{pageLevelNumberList.stream().filter(x-> x>1).toList()}">
|
||||
<h:column id="nameCol">
|
||||
<h:outputText id="name" value="#{streamResult}"/>
|
||||
</h:column>
|
||||
</h:dataTable>
|
||||
</h:panelGrid>
|
||||
</h:body>
|
||||
</html>
|
||||
|
52
src/main/webapp/el_intro.xhtml
Normal file
52
src/main/webapp/el_intro.xhtml
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:c="http://java.sun.com/jsp/jstl/core"
|
||||
xmlns:f="http://java.sun.com/jsf/core">
|
||||
<h:head>
|
||||
<title>Baeldung | The EL Intro</title>
|
||||
</h:head>
|
||||
|
||||
<h:body>
|
||||
<h:form id="elForm">
|
||||
|
||||
|
||||
<h:messages/>
|
||||
<h:panelGrid columns="2">
|
||||
<h:outputText value="First Name"/>
|
||||
<h:inputText id="firstName" binding="#{firstName}" required="true" value="#{ELBean.firstName}"/>
|
||||
<h:outputText value="Last Name"/>
|
||||
<h:inputText id="lastName" required="true" value="#{ELBean.lastName}"/>
|
||||
<h:outputText value="Save by value binding"/>
|
||||
<h:commandButton value="Save" action="#{ELBean.save}">
|
||||
|
||||
</h:commandButton>
|
||||
<h:outputText value="Evaluate backing bean EL"/>
|
||||
<h:commandButton value="Save" action="#{ELBean.saveByELEvaluation}">
|
||||
</h:commandButton>
|
||||
<h:outputText value="Save by passing value to method"/>
|
||||
<h:commandButton value="Save"
|
||||
action="#{ELBean.saveFirstName(firstName.value.toString().concat('(passed)'))}"/>
|
||||
<h:outputText value="JavaScript (click after saving First Name)"/>
|
||||
<h:button value="Alert" onclick="alert('Hello #{ELBean.firstName}')"/>
|
||||
</h:panelGrid>
|
||||
|
||||
<br/>
|
||||
<h:outputText value="Current Request HTTP Headers:"/>
|
||||
<table border="1">
|
||||
<th>Key</th>
|
||||
<th>Value</th>
|
||||
<c:forEach items="#{header}" var="header">
|
||||
<tr>
|
||||
<td>#{header.key}</td>
|
||||
<td>#{header.value}</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</table>
|
||||
|
||||
</h:form>
|
||||
</h:body>
|
||||
</html>
|
||||
|
18
src/main/webapp/form.xhtml
Normal file
18
src/main/webapp/form.xhtml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||
xmlns:f="http://xmlns.jcp.org/jsf/core" xml:lang="en_US">
|
||||
<h:head>
|
||||
<title>Jsf Form</title>
|
||||
</h:head>
|
||||
<h:body>
|
||||
<h:form id="form">
|
||||
<h:outputLabel for="username">User Name</h:outputLabel>
|
||||
<h:inputText id="username" value="#{user.name}" required="true">
|
||||
<f:validateRequired for="username" />
|
||||
</h:inputText><br/>
|
||||
<h:commandButton value="OK" action="response.xhtml"/>
|
||||
</h:form>
|
||||
</h:body>
|
||||
</html>
|
27
src/main/webapp/index.xhtml
Normal file
27
src/main/webapp/index.xhtml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:h="http://java.sun.com/jsf/html">
|
||||
<h:head>
|
||||
<title><h:outputText value="#{msg['message.welcome']}"/></title>
|
||||
</h:head>
|
||||
<h:body>
|
||||
<h:form>
|
||||
<h:panelGrid id="theGrid" columns="3">
|
||||
<h:outputText value="Username"/>
|
||||
<h:inputText id="firstName" binding="#{userName}" required="true" requiredMessage="#{msg['message.valueRequired']}"
|
||||
value="#{registration.userName}"/>
|
||||
<h:message for="firstName" style="color:red;"/>
|
||||
<h:commandButton value="#{msg['label.saveButton']}" action="#{registration.createNewUser}"
|
||||
process="@this"/>
|
||||
<!--
|
||||
Accessing the Spring bean directly from the page
|
||||
<h:commandButton value="Save"
|
||||
action="#{registration.userDao.createUser(userName.value)}"/>
|
||||
-->
|
||||
<h:outputText value="#{registration.operationMessage}" style="color:green;"/>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
</h:body>
|
||||
</html>
|
59
src/main/webapp/pf_intro.xhtml
Normal file
59
src/main/webapp/pf_intro.xhtml
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
|
||||
<h:head>
|
||||
<title>Hello Primefaces</title>
|
||||
</h:head>
|
||||
<h:body>
|
||||
<h:form id="primeForm">
|
||||
|
||||
<p:panelGrid columns="2">
|
||||
<h:outputText value="#{helloPFBean.firstName}" />
|
||||
<h:outputText value="#{helloPFBean.lastName}" />
|
||||
</p:panelGrid>
|
||||
|
||||
<h:panelGrid columns="2">
|
||||
<p:outputLabel for="jsfCompSuite" value="Component Suite" />
|
||||
<p:selectOneRadio id="jsfCompSuite"
|
||||
value="#{helloPFBean.componentSuite}">
|
||||
<f:selectItem itemLabel="ICEfaces" itemValue="ICEfaces" />
|
||||
<f:selectItem itemLabel="RichFaces" itemValue="RichFaces" />
|
||||
</p:selectOneRadio>
|
||||
</h:panelGrid>
|
||||
|
||||
<p:dataTable var="technology" value="#{helloPFBean.technologies}">
|
||||
<p:column headerText="Name">
|
||||
<h:outputText value="#{technology.name}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Version">
|
||||
<h:outputText value="#{technology.currentVersion}" />
|
||||
</p:column>
|
||||
</p:dataTable>
|
||||
|
||||
<h:panelGrid columns="3">
|
||||
<h:outputText value="Blur event " />
|
||||
<p:inputText id="inputTextId" value="#{helloPFBean.inputText}">
|
||||
<p:ajax event="blur" update="outputTextId"
|
||||
listener="#{helloPFBean.onBlurEvent}" />
|
||||
</p:inputText>
|
||||
<h:outputText id="outputTextId" value="#{helloPFBean.outputText}" />
|
||||
<p:commandButton value="Open Dialog" icon="ui-icon-note"
|
||||
onclick="PF('exDialog').show();">
|
||||
</p:commandButton>
|
||||
</h:panelGrid>
|
||||
|
||||
<p:dialog header="Example dialog" widgetVar="exDialog" minHeight="40">
|
||||
<h:outputText value="Hello Baeldung!" />
|
||||
</p:dialog>
|
||||
|
||||
</h:form>
|
||||
|
||||
</h:body>
|
||||
</html>
|
38
src/main/webapp/pfm_intro.xhtml
Normal file
38
src/main/webapp/pfm_intro.xhtml
Normal file
@@ -0,0 +1,38 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
xmlns:p="http://primefaces.org/ui"
|
||||
xmlns:pm="http://primefaces.org/mobile">
|
||||
<!--<f:view renderKitId="PRIMEFACES_MOBILE" />-->
|
||||
<h:head>
|
||||
</h:head>
|
||||
<h:body>
|
||||
<pm:page id="enter">
|
||||
<pm:header>
|
||||
<p:outputLabel value="Introduction to PFM"/>
|
||||
</pm:header>
|
||||
<pm:content>
|
||||
<h:form id="enterForm">
|
||||
<pm:field>
|
||||
<p:outputLabel value="Enter Magic Word"/>
|
||||
<p:inputText id="magicWord" value="#{helloPFMBean.magicWord}"/>
|
||||
</pm:field>
|
||||
<p:commandButton value="Go!" action="#{helloPFMBean.go}"/>
|
||||
</h:form>
|
||||
</pm:content>
|
||||
</pm:page>
|
||||
<pm:page id="success">
|
||||
<pm:content>
|
||||
<p:outputLabel value="Correct!"/>
|
||||
<p:button value="Back" outcome="pm:enter?transition=flow"/>
|
||||
</pm:content>
|
||||
</pm:page>
|
||||
<pm:page id="failure">
|
||||
<pm:content>
|
||||
<p:outputLabel value="That is not the magic word"/>
|
||||
<p:button value="Back" outcome="pm:enter?transition=flow"/>
|
||||
</pm:content>
|
||||
</pm:page>
|
||||
</h:body>
|
||||
</html>
|
11
src/main/webapp/response.xhtml
Normal file
11
src/main/webapp/response.xhtml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html">
|
||||
<h:head>
|
||||
<title>Welcome Page</title>
|
||||
</h:head>
|
||||
<h:body>
|
||||
<h2>Hello, <h:outputText value="#{user.name}"/></h2>
|
||||
</h:body>
|
||||
</html>
|
Reference in New Issue
Block a user