[jboss-cvs] jboss-seam/examples/booking/view ...
Gavin King
gavin.king at jboss.com
Thu Oct 12 18:44:47 EDT 2006
User: gavin
Date: 06/10/12 18:44:47
Modified: examples/booking/view book.xhtml main.xhtml
Log:
ajaxify the booking demo JBSEAM-388 thanks to Todd Smart
Revision Changes Path
1.15 +34 -22 jboss-seam/examples/booking/view/book.xhtml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: book.xhtml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/booking/view/book.xhtml,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- book.xhtml 11 Oct 2006 21:01:19 -0000 1.14
+++ book.xhtml 12 Oct 2006 22:44:47 -0000 1.15
@@ -4,6 +4,7 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a="https://ajax4jsf.dev.java.net/ajax"
template="template.xhtml">
<!-- content -->
@@ -37,9 +38,6 @@
<s:validateAll>
- <f:facet name="afterInvalidField">
- <s:message/>
- </f:facet>
<f:facet name="aroundInvalidField">
<s:span styleClass="errors"/>
</f:facet>
@@ -48,8 +46,13 @@
<div class="label"><h:outputLabel for="checkinDate">Check In Date:</h:outputLabel></div>
<div class="input">
<s:decorate>
- <h:inputText id="checkinDate" value="#{booking.checkinDate}" required="true"/>
- <br/>
+ <h:inputText id="checkinDate" value="#{booking.checkinDate}" required="true">
+ <a:support event="onchange" reRender="checkinDateErrors"/>
+ </h:inputText>
+ <br/>
+ <a:outputPanel id="checkinDateErrors">
+ <h:message for="checkinDate"/>
+ </a:outputPanel>
</s:decorate>
</div>
</div>
@@ -58,8 +61,13 @@
<div class="label"><h:outputLabel for="checkoutDate">Check Out Date:</h:outputLabel></div>
<div class="input">
<s:decorate>
- <h:inputText id="checkoutDate" value="#{booking.checkoutDate}" required="true"/>
- <br/>
+ <h:inputText id="checkoutDate" value="#{booking.checkoutDate}" required="true">
+ <a:support event="onchange" reRender="checkoutDateErrors"/>
+ </h:inputText>
+ <br/>
+ <a:outputPanel id="checkoutDateErrors">
+ <h:message for="checkoutDate"/>
+ </a:outputPanel>
</s:decorate>
</div>
</div>
@@ -95,18 +103,28 @@
<div class="label"><h:outputLabel for="creditCard">Credit Card #:</h:outputLabel></div>
<div class="input">
<s:decorate>
- <h:inputText id="creditCard" value="#{booking.creditCard}" required="true"/>
- <br/>
+ <h:inputText id="creditCard" value="#{booking.creditCard}" required="true">
+ <a:support event="onchange" reRender="creditCardErrors"/>
+ </h:inputText>
+ <br/>
+ <a:outputPanel id="creditCardErrors">
+ <h:message for="creditCard"/>
+ </a:outputPanel>
</s:decorate>
</div>
</div>
<div class="entry">
<div class="label"><h:outputLabel for="creditCardName">Credit Card Name:</h:outputLabel></div>
- <div class="input">
+ <div class="input" id="creditCardNameInput">
<s:decorate>
- <h:inputText id="creditCardName" value="#{booking.creditCardName}" required="true"/>
- <br/>
+ <h:inputText id="creditCardName" value="#{booking.creditCardName}" required="true">
+ <a:support event="onchange" reRender="creditCardNameErrors"/>
+ </h:inputText>
+ <br/>
+ <a:outputPanel id="creditCardNameErrors">
+ <h:message for="creditCardName"/>
+ </a:outputPanel>
</s:decorate>
</div>
</div>
@@ -115,12 +133,6 @@
<div class="label"><h:outputLabel for="creditCardExpiryMonth">Credit Card Expiry:</h:outputLabel></div>
<div class="input">
<s:decorate>
- <f:facet name="afterInvalidField">
- <f:subview>
- <h:message for="creditCardExpiryMonth" />
- <h:message for="creditCardExpiryYear" />
- </f:subview>
- </f:facet>
<h:selectOneMenu id="creditCardExpiryMonth" value="#{booking.creditCardExpiryMonth}">
<f:selectItem itemLabel="Jan" itemValue="1"/>
<f:selectItem itemLabel="Feb" itemValue="2"/>
1.22 +28 -10 jboss-seam/examples/booking/view/main.xhtml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: main.xhtml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/booking/view/main.xhtml,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- main.xhtml 11 Oct 2006 21:01:19 -0000 1.21
+++ main.xhtml 12 Oct 2006 22:44:47 -0000 1.22
@@ -4,6 +4,7 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a="https://ajax4jsf.dev.java.net/ajax"
template="template.xhtml">
<!-- content -->
@@ -11,11 +12,24 @@
<div class="section">
<h:form>
- <span class="errors"><h:messages globalOnly="true"/></span>
+
+ <span class="errors">
+ <h:messages globalOnly="true"/>
+ </span>
+
<h1>Search Hotels</h1>
<fieldset>
- <h:inputText value="#{hotelSearch.searchString}" style="width: 165px;"/> 
- <h:commandButton value="Find Hotels" action="#{hotelSearch.find}" styleClass="button"/>
+ <h:inputText value="#{hotelSearch.searchString}" style="width: 165px;">
+ <a:support event="onkeyup" actionListener="#{hotelSearch.find}" reRender="searchResults" />
+ </h:inputText>
+  
+ <a:commandButton value="Find Hotels" action="#{hotelSearch.find}" styleClass="button" reRender="searchResults"/>
+  
+ <a:status>
+ <f:facet name="start">
+ <h:graphicImage value="/img/spinner.gif"/>
+ </f:facet>
+ </a:status>
<br/>
<h:outputLabel for="pageSize">Maximum results:</h:outputLabel> 
<h:selectOneMenu value="#{hotelSearch.pageSize}" id="pageSize">
@@ -24,10 +38,12 @@
<f:selectItem itemLabel="20" itemValue="20"/>
</h:selectOneMenu>
</fieldset>
+
</h:form>
</div>
-<div class="section">
+<a:outputPanel id="searchResults">
+ <div class="section">
<h:outputText value="No Hotels Found" rendered="#{hotels != null and hotels.rowCount==0}"/>
<h:dataTable value="#{hotels}" var="hot" rendered="#{hotels.rowCount>0}">
<h:column>
@@ -52,7 +68,7 @@
</h:column>
</h:dataTable>
<s:link value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}"/>
-</div>
+ </div>
<div class="section">
<h1>Current Hotel Bookings</h1>
@@ -92,6 +108,8 @@
</h:dataTable>
</h:form>
</div>
+</a:outputPanel>
+
</ui:define>
<!-- sidebar -->
More information about the jboss-cvs-commits
mailing list