jsf-spring-integration - mavenizing

(cherry picked from commit eba201c)
This commit is contained in:
Slavisa Baeldung 2016-05-26 11:22:26 +02:00
parent ef53002000
commit 6e6f7c4e1e
7 changed files with 59 additions and 33 deletions

View File

@ -13,12 +13,39 @@
<version>0.1-SNAPSHOT</version> <version>0.1-SNAPSHOT</version>
<packaging>war</packaging> <packaging>war</packaging>
<dependencies> <dependencies>
<!-- http://mvnrepository.com/artifact/com.sun.faces/mojarra-jsf-impl -->
<dependency> <dependency>
<groupId>com.sun.faces</groupId> <groupId>com.sun.faces</groupId>
<artifactId>mojarra-jsf-impl</artifactId> <artifactId>jsf-api</artifactId>
<version>2.0.0-b04</version> <version>${com.sun.faces.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>${com.sun.faces.version}</version>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>${org.springframework.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
@ -34,4 +61,9 @@
</plugins> </plugins>
</build> </build>
<properties>
<!-- Spring -->
<org.springframework.version>4.2.5.RELEASE</org.springframework.version>
<com.sun.faces.version>2.1.7</com.sun.faces.version>
</properties>
</project> </project>

View File

@ -1,7 +1,3 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.baeldung.springintegration.dao; package com.baeldung.springintegration.dao;
import java.util.ArrayList; import java.util.ArrayList;
@ -10,16 +6,13 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
/**
* @author Tayo
*/
public class UserManagementDAOImpl extends IUserManagementDAO { public class UserManagementDAOImpl extends IUserManagementDAO {
private List<String> users; private List<String> users;
@PostConstruct @PostConstruct
public void initUserList() { public void initUserList() {
users = new ArrayList<String>(); users = new ArrayList<>();
} }
@Override @Override

View File

@ -10,6 +10,6 @@
"> ">
<bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor" /> <bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor" />
<bean class="com.baeldung.dao.UserManagementDAOImpl" id="userManagementDAO"/> <bean class="com.baeldung.springintegration.dao.UserManagementDAOImpl" id="userManagementDAO"/>
</beans> </beans>

View File

@ -10,7 +10,7 @@
<application> <application>
<resource-bundle> <resource-bundle>
<base-name> <base-name>
com.baeldung.resources.messages messages
</base-name> </base-name>
<var> <var>
msg msg
@ -18,7 +18,7 @@
</resource-bundle> </resource-bundle>
<resource-bundle> <resource-bundle>
<base-name> <base-name>
com.baeldung.resources.constraints constraints
</base-name> </base-name>
<var> <var>
constraints constraints

View File

@ -1,27 +1,28 @@
<?xml version='1.0' encoding='UTF-8' ?> <?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"> <!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" <html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"> xmlns:f="http://java.sun.com/jsf/core">
<h:head> <h:head>
<title>Baeldung | Register</title> <title>Baeldung | Register</title>
</h:head> </h:head>
<h:body> <h:body>
<h:form>
<h:form> <f:ajax>
<f:ajax> <h:panelGrid id="theGrid" columns="3">
<h:panelGrid id="theGrid" columns="3"> <h:outputText value="Username"/>
<h:outputText value="Username"/> <h:inputText id="firstName" binding="#{userNameTextbox}" required="true"
<h:inputText id="firstName" binding="#{userNameTextbox}" required="true" requiredMessage="#{msg['message.valueRequired']}" value="#{registration.userName}"/> requiredMessage="#{msg['message.valueRequired']}" value="#{registration.userName}"/>
<h:message for="firstName" /> <h:message for="firstName"/>
<h:commandButton value="#{msg['label.saveButton']}" action="#{registration.theUserDao.createUser(userNameTextbox.value)}"/> <h:commandButton value="#{msg['label.saveButton']}"
<h:outputText value="#{registration.operationMessage}"/> action="#{registration.theUserDao.createUser(userNameTextbox.value)}"/>
</h:panelGrid> <h:outputText value="#{registration.operationMessage}"/>
</f:ajax> </h:panelGrid>
</h:form> </f:ajax>
</h:form>
</h:body> </h:body>
</html> </html>