The distribution of Spring Webflow 2.3.0 includes a sample app, booking-faces which features PrimeFaces 2.2.1. When upgraded to PrimeFaces 3.1, the paginator component ceases to work correctly. Details, and a patch to create the upgraded sample app are included below. I can post the app itself if I get attachment priviledges. Note that the version of SpringWebflow itself is not changed.
BACKGROUND
I am starting a new project, and am very interested in using Spring Webflow and PrimeFaces. This decision was supported in part by my study of the booking-faces example provided by Spring which utilized PrimeFaces.
As I'd like to start on the latest production versions possible, and know that they still play well together, I undertook the exercise of upgrading the booking-faces example (from the Spring Webflow 2.3.0.RELEASE) to use those versions. When I did so, the paginator ceased to paginate, and the "View Hotel" button threw exceptions consistent with losing the searchCriteria object in the flow context.
The process by which I did the upgrade involved three steps,
- * Changing pom.xml for the new versions
* Changing to the new prime namespace url
* Changing one method signature to reflect use of enum SortOrder
DETAILS ON THE UPGRADE
1) Changing pom.xml
(note that Mojarra 2.0.8 is used here, as there is apparently an issue with Tomcat/Jetty and Mojarra 2.1.x, see this StackOverflow post)
Code: Select all
<org.springframework-version>3.1.0.RELEASE</org.springframework-version>
<org.springsecurity-version>3.1.0.RELEASE</org.springsecurity-version>
<org.springwebflow-version>2.3.0.RELEASE</org.springwebflow-version>
<jsf-version>2.0.8</jsf-version>
<primefaces-version>3.1</primefaces-version>
Code: Select all
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-faces</artifactId>
<version>${org.springwebflow-version}</version>
</dependency>
Code: Select all
$ find src/ -type f|xargs sed -i 's/primefaces.prime.com.tr/primefaces.org/g'
Code: Select all
@Override
public List<Hotel> load(int first, int pageSize, String sortField,SortOrder sortOrder, Map<String, String> filters) {
searchCriteria.setCurrentPage(first / pageSize + 1);
return bookingService.findHotels(searchCriteria, first, sortField,(sortOrder==SortOrder.ASCENDING));
}
SAMPLE APP (ATTACH PERMISSION NEEDED)
I have a cleanly modified sample app I'd like to attach, which may be run (to failure) with,
Code: Select all
$ tar xzvf booking-faces-updates.tgz # archive compressed is 216K
$ cd booking-faces-updates
$ mvn clean tomcat:run # mine is Apache Tomcat/6.0.29, also tried 7.0.12 in Eclipse and Jetty 6.1.16
OR USE PATCH AGAINST spring-webflow-2.3.0.RELEASE.zip
Until I can attach things in posts, here is a patch off of the Spring Webflow 2.3.0.RELEASE
Code: Select all
$ unzip spring-webflow-2.3.0.RELEASE.zip
$ cp -r spring-webflow-2.3.0.RELEASE/projects/spring-webflow-samples/booking-faces booking-faces-updated
$ patch -p1 -u -d booking-faces-updated < following.patch
Code: Select all
diff -Naur booking-faces/pom.xml booking-faces-update/pom.xml
--- booking-faces/pom.xml 2012-02-08 13:33:44.026288234 -0800
+++ booking-faces-update/pom.xml 2012-02-08 11:27:29.279979372 -0800
@@ -8,11 +8,12 @@
<name>Hotel Booking : Spring MVC + Web Flow + JSF/PrimeFaces</name>
<version>2.3.0.RELEASE</version>
<properties>
- <org.springframework-version>3.0.5.RELEASE</org.springframework-version>
- <org.springsecurity-version>3.0.2.RELEASE</org.springsecurity-version>
+ <org.springframework-version>3.1.0.RELEASE</org.springframework-version>
+ <org.springsecurity-version>3.1.0.RELEASE</org.springsecurity-version>
+ <org.springwebflow-version>2.3.0.RELEASE</org.springwebflow-version>
<org.slf4j-version>1.5.10</org.slf4j-version>
- <jsf-version>2.0.3</jsf-version>
- <primefaces-version>2.2.1</primefaces-version>
+ <jsf-version>2.0.8</jsf-version>
+ <primefaces-version>3.1</primefaces-version>
</properties>
<dependencies>
<!-- Spring -->
@@ -46,7 +47,7 @@
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-faces</artifactId>
- <version>${project.version}</version>
+ <version>${org.springwebflow-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
diff -Naur booking-faces/src/main/java/org/springframework/webflow/samples/booking/HotelLazyDataModel.java booking-faces-update/src/main/java/org/springframework/webflow/samples/booking/HotelLazyDataModel.java
--- booking-faces/src/main/java/org/springframework/webflow/samples/booking/HotelLazyDataModel.java 2012-02-08 13:33:44.017288315 -0800
+++ booking-faces-update/src/main/java/org/springframework/webflow/samples/booking/HotelLazyDataModel.java 2012-02-08 11:31:59.935511959 -0800
@@ -7,6 +7,7 @@
import java.util.Map;
import org.primefaces.model.LazyDataModel;
+import org.primefaces.model.SortOrder;
public class HotelLazyDataModel extends LazyDataModel<Hotel> {
@@ -23,11 +24,11 @@
this.bookingService = bookingService;
}
- @Override
- public List<Hotel> load(int first, int pageSize, String sortField, boolean sortOrder, Map<String, String> filters) {
+ @Override
+ public List<Hotel> load(int first, int pageSize, String sortField,SortOrder sortOrder, Map<String, String> filters) {
searchCriteria.setCurrentPage(first / pageSize + 1);
- return bookingService.findHotels(searchCriteria, first, sortField, sortOrder);
- }
+ return bookingService.findHotels(searchCriteria, first, sortField,(sortOrder==SortOrder.ASCENDING));
+ }
@Override
public int getRowCount() {
diff -Naur booking-faces/src/main/webapp/WEB-INF/flows/booking/enterBookingDetails.xhtml booking-faces-update/src/main/webapp/WEB-INF/flows/booking/enterBookingDetails.xhtml
--- booking-faces/src/main/webapp/WEB-INF/flows/booking/enterBookingDetails.xhtml 2012-02-08 13:33:44.025288243 -0800
+++ booking-faces-update/src/main/webapp/WEB-INF/flows/booking/enterBookingDetails.xhtml 2012-02-08 11:29:39.815813774 -0800
@@ -3,7 +3,7 @@
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.prime.com.tr/ui"
+ xmlns:p="http://primefaces.org/ui"
template="/WEB-INF/layouts/standard.xhtml">
<ui:define name="notes">
<p>
diff -Naur booking-faces/src/main/webapp/WEB-INF/flows/booking/reviewBooking.xhtml booking-faces-update/src/main/webapp/WEB-INF/flows/booking/reviewBooking.xhtml
--- booking-faces/src/main/webapp/WEB-INF/flows/booking/reviewBooking.xhtml 2012-02-08 13:33:44.025288243 -0800
+++ booking-faces-update/src/main/webapp/WEB-INF/flows/booking/reviewBooking.xhtml 2012-02-08 11:29:39.814813783 -0800
@@ -3,7 +3,7 @@
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.prime.com.tr/ui"
+ xmlns:p="http://primefaces.org/ui"
template="/WEB-INF/layouts/standard.xhtml">
<ui:define name="notes">
<p>
diff -Naur booking-faces/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.xhtml booking-faces-update/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.xhtml
--- booking-faces/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.xhtml 2012-02-08 13:33:44.025288243 -0800
+++ booking-faces-update/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.xhtml 2012-02-08 11:29:39.813813792 -0800
@@ -3,7 +3,7 @@
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.prime.com.tr/ui"
+ xmlns:p="http://primefaces.org/ui"
template="/WEB-INF/layouts/standard.xhtml">
<ui:define name="notes">
diff -Naur booking-faces/src/main/webapp/WEB-INF/flows/main/reviewHotels.xhtml booking-faces-update/src/main/webapp/WEB-INF/flows/main/reviewHotels.xhtml
--- booking-faces/src/main/webapp/WEB-INF/flows/main/reviewHotels.xhtml 2012-02-08 13:33:44.025288243 -0800
+++ booking-faces-update/src/main/webapp/WEB-INF/flows/main/reviewHotels.xhtml 2012-02-08 11:29:39.812813801 -0800
@@ -3,7 +3,7 @@
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.prime.com.tr/ui"
+ xmlns:p="http://primefaces.org/ui"
template="/WEB-INF/layouts/standard.xhtml">
<ui:define name="notes">
<p>
diff -Naur booking-faces/src/main/webapp/WEB-INF/flows/main/reviewHotel.xhtml booking-faces-update/src/main/webapp/WEB-INF/flows/main/reviewHotel.xhtml
--- booking-faces/src/main/webapp/WEB-INF/flows/main/reviewHotel.xhtml 2012-02-08 13:33:44.025288243 -0800
+++ booking-faces-update/src/main/webapp/WEB-INF/flows/main/reviewHotel.xhtml 2012-02-08 11:29:39.812813801 -0800
@@ -3,7 +3,7 @@
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.prime.com.tr/ui"
+ xmlns:p="http://primefaces.org/ui"
template="/WEB-INF/layouts/standard.xhtml">
<ui:define name="notes">
<p>
diff -Naur booking-faces/src/main/webapp/WEB-INF/layouts/standard.xhtml booking-faces-update/src/main/webapp/WEB-INF/layouts/standard.xhtml
--- booking-faces/src/main/webapp/WEB-INF/layouts/standard.xhtml 2012-02-08 13:33:44.024288252 -0800
+++ booking-faces-update/src/main/webapp/WEB-INF/layouts/standard.xhtml 2012-02-08 11:29:39.806813855 -0800
@@ -4,7 +4,7 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:p="http://primefaces.prime.com.tr/ui">
+ xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html">
Any help appreciated,
-SM