From e4645ee5c6e1cf5412498ed51d8535c4dd247624 Mon Sep 17 00:00:00 2001 From: Jeremy Grelle Date: Tue, 4 Dec 2007 21:47:33 +0000 Subject: [PATCH] -Reorganized the main flow to show the hotel search results on a seperate page, showing the ability to use AJAX to render a partial view fragment into a nice javascript dialog box if javascript is turned on, but perform a full page refresh if it is turned off. --- .../booking/flow/main/SearchCriteria.java | 11 ++ .../main/webapp/flow/main/displayHotels.xhtml | 62 ++++++ .../src/main/webapp/flow/main/main.xhtml | 184 +++++++----------- .../src/main/webapp/flow/main/main.xml | 17 +- 4 files changed, 155 insertions(+), 119 deletions(-) create mode 100644 spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/displayHotels.xhtml diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/SearchCriteria.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/SearchCriteria.java index 0f9eacad..1674f2be 100755 --- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/SearchCriteria.java +++ b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/SearchCriteria.java @@ -7,6 +7,7 @@ import java.util.List; import javax.faces.event.ActionEvent; import javax.faces.model.SelectItem; +import org.springframework.util.StringUtils; import org.springframework.webflow.samples.booking.app.BookingService; /** @@ -95,4 +96,14 @@ public class SearchCriteria implements Serializable { } return pageSizeOptions; } + + public String toString() { + StringBuffer criteria = new StringBuffer(); + if (StringUtils.hasText(searchString)) { + criteria.append("Text: " + searchString + ", "); + } + criteria.append("Page Size: " + pageSize); + return criteria.toString(); + } + } diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/displayHotels.xhtml b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/displayHotels.xhtml new file mode 100644 index 00000000..9baab297 --- /dev/null +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/displayHotels.xhtml @@ -0,0 +1,62 @@ + + + + + +
+ +

Hotel Results

+

+ Search Criteria: #{searchCriteria}
+ +

+ + + + Name + #{hotel.name} + + + Address + #{hotel.address} + + + City, State + #{hotel.city}, #{hotel.state}, #{hotel.country} + + + Zip + #{hotel.zip} + + + Action + + + + + + +
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xhtml b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xhtml index 0e2d4c0a..068f9c36 100755 --- a/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xhtml +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xhtml @@ -7,121 +7,81 @@ template="/template.xhtml"> - + +
+ + + +

Search Hotels

-
- - - -

Search Hotels

-
-
-
-
-
-
- - - -
-
- Maximum results: - - - - - - - -
-
- -
-
-
-
- - -
- - - - Name - #{hotel.name} - - - Address - #{hotel.address} - - - City, State - #{hotel.city}, #{hotel.state}, #{hotel.country} - - - Zip - #{hotel.zip} - - - Action - - - - - - + +
+
+
+
+
+ + + +
+
+ Maximum results: + + + + + +
+
+ +
+
+
+
+
-
- -
-

Current Hotel Bookings

- - - - - Name - #{booking.hotel.name} - - - Address - #{booking.hotel.address} - - - City, State - #{booking.hotel.city}, #{booking.hotel.state} - - - Check in date - - - - Check out date - - - - Confirmation number - #{booking.id} - - - Action - - - - -
-
- - + +
+ +

Current Hotel Bookings

+ + + + + Name + #{booking.hotel.name} + + + Address + #{booking.hotel.address} + + + City, State + #{booking.hotel.city}, #{booking.hotel.state} + + + Check in date + + + + Check out date + + + + Confirmation number + #{booking.id} + + + Action + + + + +
+
+
+ \ No newline at end of file diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xml b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xml index 0c038640..694b5231 100755 --- a/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xml +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xml @@ -17,18 +17,21 @@ - - - - - - - + + + + + + + + + +