Author: dan.j.allen
Date: 2009-05-04 00:33:40 -0400 (Mon, 04 May 2009)
New Revision: 10762
Modified:
examples/trunk/booking/war/src/main/webapp/book.xhtml
Log:
use <f:selectItems> rather than hard-coding options
Modified: examples/trunk/booking/war/src/main/webapp/book.xhtml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/book.xhtml 2009-05-04 04:33:25 UTC (rev
10761)
+++ examples/trunk/booking/war/src/main/webapp/book.xhtml 2009-05-04 04:33:40 UTC (rev
10762)
@@ -61,25 +61,10 @@
<p:edit id="creditCardExpiry" label="Credit card
expiry">
<h:selectOneMenu id="input"
value="#{booking.creditCardExpiryMonth}">
- <f:selectItem itemLabel="Jan"
itemValue="1"/>
- <f:selectItem itemLabel="Feb"
itemValue="2"/>
- <f:selectItem itemLabel="Mar"
itemValue="3"/>
- <f:selectItem itemLabel="Apr"
itemValue="4"/>
- <f:selectItem itemLabel="May"
itemValue="5"/>
- <f:selectItem itemLabel="Jun"
itemValue="6"/>
- <f:selectItem itemLabel="Jul"
itemValue="7"/>
- <f:selectItem itemLabel="Aug"
itemValue="8"/>
- <f:selectItem itemLabel="Sep"
itemValue="9"/>
- <f:selectItem itemLabel="Oct"
itemValue="10"/>
- <f:selectItem itemLabel="Nov"
itemValue="11"/>
- <f:selectItem itemLabel="Dec"
itemValue="12"/>
+ <f:selectItems value="#{months}" var="_month"
itemValue="#{_month.number}" itemLabel="#{_month.shortName}"/>
</h:selectOneMenu>
<h:selectOneMenu id="input2"
value="#{booking.creditCardExpiryYear}">
- <f:selectItem itemLabel="2009"
itemValue="2009"/>
- <f:selectItem itemLabel="2010"
itemValue="2010"/>
- <f:selectItem itemLabel="2011"
itemValue="2011"/>
- <f:selectItem itemLabel="2012"
itemValue="2012"/>
- <f:selectItem itemLabel="2013"
itemValue="2013"/>
+ <f:selectItems value="#{creditCardExpiryYears}"
var="_year" itemValue="#{_year}"/>
</h:selectOneMenu>
</p:edit>
Show replies by thread