[jboss-cvs] jboss-seam/examples/spring/view ...

Norman Richards norman.richards at jboss.com
Mon Feb 19 16:55:02 EST 2007


  User: nrichards
  Date: 07/02/19 16:55:02

  Modified:    examples/spring/view    hotel.xhtml main.xhtml
                        template.xhtml
  Log:
  booking
  
  Revision  Changes    Path
  1.2       +83 -62    jboss-seam/examples/spring/view/hotel.xhtml
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: hotel.xhtml
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/spring/view/hotel.xhtml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- hotel.xhtml	19 Feb 2007 19:30:26 -0000	1.1
  +++ hotel.xhtml	19 Feb 2007 21:55:02 -0000	1.2
  @@ -6,12 +6,12 @@
                   xmlns:s="http://jboss.com/products/seam/taglib"
                   template="template.xhtml">
       
  -    <!-- content -->
  -    <ui:define name="content">
  -        <div class="section">
  +<!-- content -->
  +<ui:define name="content">
  +<div class="section">
               <h1>View Hotel</h1>
  -        </div>
  -        <div class="section">
  +</div>
  +<div class="section">
               <div class="entry">
                   <div class="label">Name:</div>
                   <div class="output">#{hotel.name}</div>
  @@ -45,18 +45,39 @@
                       </h:outputText>
                   </div>
               </div>
  -        </div>
  -
  -        <div class="section">
  +</div>
  +<div class="section">
               <h:form id="hotel">
                   <fieldset class="buttonBox">
                       <h:commandButton id="bookHotel" action="#{hotelBooking.bookHotel}" value="Book Hotel"/>&#160;
                       <h:commandButton id="cancel" action="#{hotelBooking.cancel}" value="Back to Search"/>
                   </fieldset>
               </h:form>
  -        </div>
  -    </ui:define>
  +</div>
  +</ui:define>
  +
  +<!-- sidebar -->
  +<ui:define name="sidebar">
  +
  +<h1>Don't kill your database</h1>
  +<p>
  +    Keeping conversational state in memory in the middle tier is a great way to
  +    improve your application's scalability. It saves hitting the database every
  +    time we refresh a page, to re-read the data we were just looking at five 
  +    seconds ago. By using Seam's conversation context, we get a natural cache 
  +    of data associated with the what the user is currently doing. By nature, 
  +    this cache has a more efficient eviction policy than the MRU-type algorithms 
  +    used by a typical second-level data cache in an O/R mapping engine like
  +    Hibernate (at least for some kinds of data). Of course, you should use 
  +    a clever combination of second-level caching and conversational data
  +    caching to achieve the best performance for your application.
  +</p>
  +<p>
  +   <a href="#" onclick="window.open('exp/bookingExp.html','exp','width=752,height=500,scrollbars=yes');">
  +      How does the hotel booking wizard work?
  +   </a>
  +</p>
   
  -    <ui:define name="sidebar"> </ui:define>
  +</ui:define>
   
   </ui:composition>
  
  
  
  1.2       +138 -112  jboss-seam/examples/spring/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/spring/view/main.xhtml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- main.xhtml	19 Feb 2007 19:30:26 -0000	1.1
  +++ main.xhtml	19 Feb 2007 21:55:02 -0000	1.2
  @@ -4,12 +4,13 @@
                   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 -->
   <ui:define name="content">
       
  -    <div class="section">
  +<div class="section">
           <h:form id="main">
               
               <span class="errors">
  @@ -18,10 +19,17 @@
               
               <h1>Search Hotels</h1>
               <fieldset> 
  -                <h:inputText id="searchString" value="#{hotelSearch.searchString}" style="width: 165px;" />
  +	   <h:inputText id="searchString" value="#{hotelSearch.searchString}" style="width: 165px;">
  +         <a:support event="onkeyup" actionListener="#{hotelSearch.find}" reRender="searchResults" />
  +       </h:inputText>
                   &#160;
  -                <h:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}" />
  +	   <a:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}" reRender="searchResults"/>
                   &#160;
  +       <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>&#160;
                   <h:selectOneMenu value="#{hotelSearch.pageSize}" id="pageSize">
  @@ -32,12 +40,12 @@
               </fieldset>        
               
           </h:form>
  -    </div>
  -    
  +</div>
   
  +<a:outputPanel id="searchResults">
       <div class="section">
  -        <h:outputText value="No Hotels Found" rendered="#{hotelSearch.hotelsModel != null and hotelSearch.hotelsModel.rowCount==0}"/>
  -        <h:dataTable id="hotels" value="#{hotelSearch.hotelsModel}" var="hot" rendered="#{hotelSearch.hotelsModel.rowCount>0}">
  +	<h:outputText value="No Hotels Found" rendered="#{hotels != null and hotels.rowCount==0}"/>
  +	<h:dataTable id="hotels" value="#{hotels}" var="hot" rendered="#{hotels.rowCount>0}">
               <h:column>
                   <f:facet name="header">Name</f:facet>
                   #{hot.name}
  @@ -56,19 +64,17 @@
               </h:column>
               <h:column>
                   <f:facet name="header">Action</f:facet>
  -                
  -                <h:form>
  -                    <h:commandLink value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
  -                </h:form>
  +			<s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
               </h:column>
           </h:dataTable>
           <s:link value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}"/>
       </div>
  +</a:outputPanel>
   
  -    <div class="section">
  +<div class="section">
           <h1>Current Hotel Bookings</h1>
  -    </div>
  -    <div class="section">
  +</div>
  +<div class="section">
           <h:form id="bookings">
               <h:outputText value="No Bookings Found" rendered="#{bookings.rowCount==0}"/>
               <h:dataTable id="bookings" value="#{bookings}" var="book" rendered="#{bookings.rowCount>0}">
  @@ -102,11 +108,31 @@
                   </h:column>
               </h:dataTable>
           </h:form>
  -    </div>
  +</div>
       
   </ui:define>
   
   <!-- sidebar -->
  -<ui:define name="sidebar"></ui:define>
  +<ui:define name="sidebar">
  +
  +<h1>State management in Seam</h1>
  +<p>
  +   State in Seam is <em>contextual</em>. When you click "Find Hotels", the application
  +   retrieves a list of hotels from the database and caches it in the session context. When you
  +   navigate to one of the hotel records by clicking the "View Hotel" link, a <em>conversation</em> 
  +   begins. The conversation is attached to a particular tab, in a particular browser window. You can
  +   navigate to multiple hotels using "open in new tab" or "open in new window" in your web browser.
  +   Each window will execute in the context of a different conversation. The application keeps state
  +   associated with your hotel booking in the conversation context, which ensures that the concurrent
  +   conversations do not interfere with each other.
  +</p>
  +
  +<p>
  +   <a href="#" onclick="window.open('exp/mainExp.html','exp','width=752,height=500,scrollbars=yes');">
  +      How does the search page work?
  +   </a>
  +</p>
  +
  +</ui:define>
   
   </ui:composition>
  
  
  
  1.2       +36 -36    jboss-seam/examples/spring/view/template.xhtml
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: template.xhtml
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/spring/view/template.xhtml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- template.xhtml	19 Feb 2007 19:30:26 -0000	1.1
  +++ template.xhtml	19 Feb 2007 21:55:02 -0000	1.2
  @@ -18,7 +18,7 @@
               Welcome #{user.name}
               | <s:link id="search" view="/main.xhtml" value="Search" propagation="none"/>
               | <s:link id="settings" view="/password.xhtml" value="Settings" propagation="none"/>
  -            | <s:link id="logout" action="#{identity.logout}" value="Logout"/>
  +            | <s:link id="logout" action="#{login.logout}" value="Logout"/>
   		</div>
   	</div>
   	<div id="container">
  
  
  



More information about the jboss-cvs-commits mailing list