synced with faces

This commit is contained in:
Keith Donald
2008-03-20 06:37:03 +00:00
parent 67522988a8
commit 9151bdbf1c
3 changed files with 29 additions and 53 deletions

View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
<secured attributes="ROLE_USER" />

View File

@@ -20,45 +20,11 @@
<form:option label="10" value="10"/>
<form:option label="20" value="20"/>
</form:select>
<input type="submit" class="button" name="_eventId_findHotels" value="Find Hotels" />
<input type="submit" class="button" name="_eventId_search" value="Find Hotels" />
</fieldset>
</div>
</form:form>
<c:if test="${not empty searchCriteria.searchString or not empty hotels}">
<div class="section">
<table class="summary">
<thead>
<tr>
<th>Name</th>
<th>Address</th>
<th>City, State</th>
<th>Zip</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<c:forEach var="hotel" items="${hotels}">
<tr>
<td>${hotel.name}</td>
<td>${hotel.address}</td>
<td>${hotel.city}, ${hotel.state}, ${hotel.country}</td>
<td>${hotel.zip}</td>
<td>
<a href="${flowExecutionUrl}&_eventId=selectHotel&hotelId=${hotel.id}">View Hotel</a>
</td>
</tr>
</c:forEach>
<c:if test="${empty hotels}">
<tr>
<td colspan="5">No hotels found</td>
</tr>
</c:if>
</tbody>
</table>
</div>
</c:if>
<security:authorize ifAllGranted="ROLE_USER">
<div class="section">
<h1>Current Hotel Bookings</h1>
@@ -99,6 +65,5 @@
</div>
</security:authorize>
</tiles:putAttribute>
</tiles:insertTemplate>

View File

@@ -1,38 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
<var name="searchCriteria" class="org.springframework.webflow.samples.booking.SearchCriteria" />
<view-state id="main">
<view-state id="enterSearchCriteria" model="searchCriteria">
<on-render>
<evaluate expression="bookingService.findBookings(currentUser.name)" result="requestScope.bookings" />
</on-render>
<transition on="findHotels">
<bind target="searchCriteria" />
<evaluate expression="bookingService.findHotels(searchCriteria)" result="flowScope.hotels" />
</transition>
<transition on="selectHotel" to="reviewHotel">
<evaluate expression="bookingService.findHotelById(requestParameters.hotelId)" result="flowScope.hotel" />
</transition>
<transition on="cancelBooking">
<transition on="search" to="reviewHotels" />
<transition on="cancelBooking" bind="false">
<evaluate expression="bookingService.cancelBooking(requestParameters.bookingId)" />
</transition>
</view-state>
<view-state id="reviewHotels">
<on-render>
<evaluate expression="bookingService.findHotels(searchCriteria)" result="requestScope.hotels" />
</on-render>
<transition on="previous">
<evaluate expression="searchCriteria.previousPage()" />
</transition>
<transition on="next">
<evaluate expression="searchCriteria.nextPage()" />
</transition>
<transition on="select" to="reviewHotel">
<set name="flowScope.hotelId" value="requestParameters.hotelId" type="long"/>
</transition>
<transition on="changeSearch" to="enterSearchCriteria" />
</view-state>
<view-state id="reviewHotel">
<on-render>
<evaluate expression="bookingService.findHotel(hotelId)" result="requestScope.hotel" />
</on-render>
<transition on="book" to="bookHotel" />
<transition on="cancel" to="main" />
<transition on="cancel" to="enterSearchCriteria" />
</view-state>
<subflow-state id="bookHotel" subflow="booking">
<input name="hotelId" value="flowScope.hotel.id" />
<input name="hotelId" />
<transition on="bookingConfirmed" to="finish" />
<transition on="cancel" to="main" />
<transition on="cancel" to="enterSearchCriteria" />
</subflow-state>
<end-state id="finish"/>
</flow>