JAVA-29231 Move modules inside existing container modules (#15492)
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
package com.baeldung.springintegration.config;
|
||||
|
||||
import com.sun.faces.config.FacesInitializer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.WebApplicationInitializer;
|
||||
import org.springframework.web.context.ContextLoaderListener;
|
||||
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import java.util.Set;
|
||||
|
||||
public class MainWebAppInitializer extends FacesInitializer implements WebApplicationInitializer {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MainWebAppInitializer.class);
|
||||
|
||||
@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 {
|
||||
LOGGER.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));
|
||||
}
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.baeldung.springintegration.config;
|
||||
|
||||
import com.baeldung.springintegration.dao.UserManagementDAO;
|
||||
import com.baeldung.springintegration.dao.UserManagementDAOImpl;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class SpringCoreConfig {
|
||||
|
||||
@Bean
|
||||
public UserManagementDAO userManagementDAO() {
|
||||
return new UserManagementDAOImpl();
|
||||
}
|
||||
}
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
package com.baeldung.springintegration.controllers;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.el.ELContextEvent;
|
||||
import javax.el.ELContextListener;
|
||||
import javax.el.LambdaExpression;
|
||||
import javax.faces.application.Application;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.el.LambdaExpression;
|
||||
import javax.faces.bean.ManagedBean;
|
||||
import javax.faces.bean.ViewScoped;
|
||||
import javax.faces.context.FacesContext;
|
||||
import java.util.Collection;
|
||||
import java.util.Random;
|
||||
|
||||
@ManagedBean(name = "ELBean")
|
||||
@ViewScoped
|
||||
public class ELSampleBean {
|
||||
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
private String pageDescription = "This page demos JSF EL Basics";
|
||||
public static final String constantField = "THIS_IS_NOT_CHANGING_ANYTIME_SOON";
|
||||
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("com.baeldung.springintegration.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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the firstName
|
||||
*/
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param firstName the firstName to set
|
||||
*/
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lastName
|
||||
*/
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lastName the lastName to set
|
||||
*/
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the pageDescription
|
||||
*/
|
||||
public String getPageDescription() {
|
||||
return pageDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pageDescription the pageDescription to set
|
||||
*/
|
||||
public void setPageDescription(String pageDescription) {
|
||||
this.pageDescription = pageDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the pageCounter
|
||||
*/
|
||||
public int getPageCounter() {
|
||||
return pageCounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pageCounter the pageCounter to set
|
||||
*/
|
||||
public void setPageCounter(int pageCounter) {
|
||||
this.pageCounter = pageCounter;
|
||||
}
|
||||
}
|
||||
+120
@@ -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<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();
|
||||
}
|
||||
|
||||
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<Technology> getTechnologies() {
|
||||
return technologies;
|
||||
}
|
||||
|
||||
public void setTechnologies(List<Technology> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+28
@@ -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";
|
||||
}
|
||||
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.baeldung.springintegration.controllers;
|
||||
|
||||
import com.baeldung.springintegration.dao.UserManagementDAO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.faces.bean.ManagedBean;
|
||||
import javax.faces.bean.ManagedProperty;
|
||||
import javax.faces.bean.ViewScoped;
|
||||
import javax.faces.context.FacesContext;
|
||||
import java.io.Serializable;
|
||||
|
||||
@ManagedBean(name = "registration")
|
||||
@ViewScoped
|
||||
public class RegistrationBean implements Serializable {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RegistrationBean.class);
|
||||
|
||||
@ManagedProperty(value = "#{userManagementDAO}")
|
||||
transient private UserManagementDAO userDao;
|
||||
private String userName;
|
||||
private String operationMessage;
|
||||
|
||||
public void createNewUser() {
|
||||
try {
|
||||
LOGGER.info("Creating new user");
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
boolean operationStatus = userDao.createUser(userName);
|
||||
context.isValidationFailed();
|
||||
if (operationStatus) {
|
||||
operationMessage = "User " + userName + " created";
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOGGER.error("Error registering new user ");
|
||||
ex.printStackTrace();
|
||||
operationMessage = "Error " + userName + " not created";
|
||||
}
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public void setUserDao(UserManagementDAO userDao) {
|
||||
this.userDao = userDao;
|
||||
}
|
||||
|
||||
public UserManagementDAO getUserDao() {
|
||||
return this.userDao;
|
||||
}
|
||||
|
||||
public String getOperationMessage() {
|
||||
return operationMessage;
|
||||
}
|
||||
|
||||
public void setOperationMessage(String operationMessage) {
|
||||
this.operationMessage = operationMessage;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.baeldung.springintegration.dao;
|
||||
|
||||
public interface UserManagementDAO {
|
||||
|
||||
boolean createUser(String newUserData);
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.baeldung.springintegration.dao;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Repository
|
||||
public class UserManagementDAOImpl implements UserManagementDAO {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(UserManagementDAOImpl.class);
|
||||
|
||||
private List<String> users;
|
||||
|
||||
@PostConstruct
|
||||
public void initUserList() {
|
||||
users = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createUser(String newUserData) {
|
||||
if (newUserData != null) {
|
||||
users.add(newUserData);
|
||||
LOGGER.info("User {} successfully created", newUserData);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public UserManagementDAOImpl() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.springframework" level="WARN" />
|
||||
<logger name="org.springframework.transaction" level="WARN" />
|
||||
|
||||
<!-- in order to debug some marshalling issues, this needs to be TRACE -->
|
||||
<logger name="org.springframework.web.servlet.mvc" level="WARN" />
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,3 @@
|
||||
message.valueRequired = This value is required
|
||||
message.welcome = Baeldung | Register
|
||||
label.saveButton = Save
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Context antiJARLocking="true" path="/Baeldung"/>
|
||||
@@ -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>
|
||||
|
||||
<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>
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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>
|
||||
|
||||
@@ -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>
|
||||
@@ -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"></p:outputLabel>
|
||||
</pm:header>
|
||||
<pm:content>
|
||||
<h:form id="enterForm">
|
||||
<pm:field>
|
||||
<p:outputLabel value="Enter Magic Word"></p:outputLabel>
|
||||
<p:inputText id="magicWord" value="#{helloPFMBean.magicWord}"></p:inputText>
|
||||
</pm:field>
|
||||
<p:commandButton value="Go!" action="#{helloPFMBean.go}"></p:commandButton>
|
||||
</h:form>
|
||||
</pm:content>
|
||||
</pm:page>
|
||||
<pm:page id="success">
|
||||
<pm:content>
|
||||
<p:outputLabel value="Correct!"></p:outputLabel>
|
||||
<p:button value="Back" outcome="pm:enter?transition=flow"></p:button>
|
||||
</pm:content>
|
||||
</pm:page>
|
||||
<pm:page id="failure">
|
||||
<pm:content>
|
||||
<p:outputLabel value="That is not the magic word"></p:outputLabel>
|
||||
<p:button value="Back" outcome="pm:enter?transition=flow"></p:button>
|
||||
</pm:content>
|
||||
</pm:page>
|
||||
</h:body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user