http://jira.springframework.org/browse/SWF-834 Sample apps should demonstrate collection and enum binding

This commit is contained in:
Scott Andrews
2008-08-13 14:22:28 +00:00
parent 05c1bca58c
commit dada0b2ef4
7 changed files with 68 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
package org.springframework.webflow.samples.booking;
public enum Amenity {
OCEAN_VIEW, LATE_CHECKOUT, MINIBAR;
}

View File

@@ -49,6 +49,8 @@ public class Booking implements Serializable {
private int beds;
private Amenity amenities;
public Booking() {
}
@@ -178,6 +180,15 @@ public class Booking implements Serializable {
this.creditCardExpiryYear = creditCardExpiryYear;
}
@Transient
public Amenity getAmenities() {
return amenities;
}
public void setAmenities(Amenity amenities) {
this.amenities = amenities;
}
public void validateEnterBookingDetails(MessageContext context) {
if (checkinDate.before(today())) {
context.addMessage(new MessageBuilder().error().source("checkinDate").code(

View File

@@ -89,6 +89,18 @@
</h:selectOneRadio>
</div>
</div>
<div class="field">
<div class="label">
<h:outputLabel for="amenities">Amenities:</h:outputLabel>
</div>
<div class="input">
<h:selectOneRadio id="amenities" value="#{booking.amenities}" layout="pageDirection">
<f:selectItem itemValue="OCEAN_VIEW" itemLabel="Ocean View" />
<f:selectItem itemValue="LATE_CHECKOUT" itemLabel="Late Checkout" />
<f:selectItem itemValue="MINIBAR" itemLabel="Minibar" />
</h:selectOneRadio>
</div>
</div>
<div class="field">
<div class="label">
<h:outputLabel for="creditCard">Credit Card #:</h:outputLabel>