diff --git a/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingFlowHandler.java b/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingFlowHandler.java new file mode 100644 index 00000000..fdea70ad --- /dev/null +++ b/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingFlowHandler.java @@ -0,0 +1,16 @@ +package org.springframework.webflow.samples.booking; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.RedirectView; +import org.springframework.webflow.core.collection.AttributeMap; +import org.springframework.webflow.mvc.AbstractFlowHandler; + +public class BookingFlowHandler extends AbstractFlowHandler { + public ModelAndView handleExecutionOutcome(String outcome, AttributeMap output, HttpServletRequest request, + HttpServletResponse response) { + return new ModelAndView(new RedirectView("/spring/hotels/index", true)); + } +} diff --git a/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/HotelsController.java b/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/HotelsController.java new file mode 100644 index 00000000..56847828 --- /dev/null +++ b/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/HotelsController.java @@ -0,0 +1,32 @@ +package org.springframework.webflow.samples.booking; + +import java.util.List; + +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; + +public class HotelsController { + private BookingService bookingService; + + public HotelsController(BookingService bookingService) { + this.bookingService = bookingService; + } + + @RequestMapping(method = RequestMethod.GET) + public void index(SearchCriteria searchCriteria) { + } + + @RequestMapping + @ModelAttribute("hotels") + public List search(SearchCriteria criteria) { + return bookingService.findHotels(criteria); + } + + @RequestMapping(method = RequestMethod.GET) + public Hotel show(@RequestParam("id") Long id) { + return bookingService.findHotelById(id); + } + +} diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/flows/booking/booking.xml b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/flows/booking/booking.xml index 1d59b081..787b8821 100755 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/flows/booking/booking.xml +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/flows/booking/booking.xml @@ -7,7 +7,7 @@ - + diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/index.jsp b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/index.jsp new file mode 100644 index 00000000..76a90b79 --- /dev/null +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/index.jsp @@ -0,0 +1,69 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> + + + + + +
+ + + +

Search Hotels

+
+ + + + + + + + +
+
+
+ + +
+

Current Hotel Bookings

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAddressCity, StateCheck in DateCheck out DateConfirmation NumberAction
${booking.hotel.name}${booking.hotel.address}${booking.hotel.city}, ${booking.hotel.state}${booking.checkinDate}${booking.checkoutDate}${booking.id} + Cancel +
No booking history
+
+
+ +
+
\ No newline at end of file diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/search.jsp b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/search.jsp new file mode 100644 index 00000000..3ef0b00f --- /dev/null +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/search.jsp @@ -0,0 +1,47 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> + + + + +
+

Hotel Results

+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAddressCity, StateZipAction
${hotel.name}${hotel.address}${hotel.city}, ${hotel.state}, ${hotel.country}${hotel.zip} + View Hotel +
No hotels found
+
+
+ +
+
\ No newline at end of file diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/show.jsp b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/show.jsp new file mode 100644 index 00000000..4be970a2 --- /dev/null +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/show.jsp @@ -0,0 +1,56 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> + + + + +
+

View Hotel

+
+ +
+ +
+
+
Name:
+
${hotel.name}
+
+
+
Address:
+
${hotel.address}
+
+
+
City:
+
${hotel.city}
+
+
+
State:
+
${hotel.state}
+
+
+
Zip:
+
${hotel.zip}
+
+
+
Country:
+
${hotel.country}
+
+
+
Nightly rate:
+
+ ${status.value} +
+
+ +
+   +   +
+
+
+
+ +
+
\ No newline at end of file diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/web-application-config.xml b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/web-application-config.xml old mode 100755 new mode 100644 index 12528766..eab40306 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/web-application-config.xml +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/web-application-config.xml @@ -18,8 +18,8 @@ - /main=flowController - /booking=flowController + /hotels/booking=bookingFlowHandler + /hotels/*=hotelsController @@ -28,11 +28,21 @@ - - + + + + + + + + + + + + diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/index.html b/spring-webflow-samples/booking-mvc/src/main/webapp/index.html index fce35507..e022195d 100755 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/index.html +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/index.html @@ -1,5 +1,5 @@ - + \ No newline at end of file