[jboss-cvs] jboss-seam/examples/spring/view ...
Norman Richards
norman.richards at jboss.com
Mon Feb 19 14:30:26 EST 2007
User: nrichards
Date: 07/02/19 14:30:26
Modified: examples/spring/view hotels.xhtml index.xhtml
Added: examples/spring/view conversations.xhtml hotel.xhtml
main.xhtml template.xhtml
Log:
booking
Revision Changes Path
1.3 +138 -27 jboss-seam/examples/spring/view/hotels.xhtml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: hotels.xhtml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/spring/view/hotels.xhtml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- hotels.xhtml 18 Feb 2007 20:00:43 -0000 1.2
+++ hotels.xhtml 19 Feb 2007 19:30:26 -0000 1.3
@@ -1,27 +1,138 @@
-<html xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:s="http://jboss.com/products/seam/taglib"
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core">
+ 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">
+ <h:form id="main">
+
+ <span class="errors">
+ <h:messages globalOnly="true"/>
+ </span>
+
+ <h1>Search Hotels</h1>
+ <fieldset>
+ <h:inputText id="searchString" value="#{hotelSearch.searchString}" style="width: 165px;">
+ <a:support event="onkeyup" actionListener="#{hotelSearch.find}" reRender="searchResults" />
+ </h:inputText>
+  
+ <a:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}" 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">
+ <f:selectItem itemLabel="5" itemValue="5"/>
+ <f:selectItem itemLabel="10" itemValue="10"/>
+ <f:selectItem itemLabel="20" itemValue="20"/>
+ </h:selectOneMenu>
+ </fieldset>
+
+ </h:form>
+</div>
+
+<a:outputPanel id="searchResults">
+ <div class="section">
+ <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}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Address</f:facet>
+ #{hot.address}
+ </h:column>
+ <h:column>
+ <f:facet name="header">City, State</f:facet>
+ #{hot.city}, #{hot.state}, #{hot.country}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Zip</f:facet>
+ #{hot.zip}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Action</f:facet>
+ <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">
+ <h1>Current Hotel Bookings</h1>
+</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}">
+ <h:column>
+ <f:facet name="header">Name</f:facet>
+ #{book.hotel.name}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Address</f:facet>
+ #{book.hotel.address}
+ </h:column>
+ <h:column>
+ <f:facet name="header">City, State</f:facet>
+ #{book.hotel.city}, #{book.hotel.state}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Check in date</f:facet>
+ <h:outputText value="#{book.checkinDate}"/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">Check out date</f:facet>
+ <h:outputText value="#{book.checkoutDate}"/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">Confirmation number</f:facet>
+ #{book.id}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Action</f:facet>
+ <h:commandLink id="cancel" value="Cancel" action="#{bookingList.cancel}"/>
+ </h:column>
+ </h:dataTable>
+ </h:form>
+</div>
+
+</ui:define>
+
+<!-- sidebar -->
+<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>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <title>Seam/Spring Integration Example</title>
-</head>
-<body>
-
- <h1>seamBookingDao</h1>
- <ul>
- <ui:repeat value="#{seamBookingDao.hotels}" var="hotel">
- <li>#{hotel.name}</li>
- </ui:repeat>
- </ul>
-
-
- <h1>springBookingDao</h1>
- <ul>
- <ui:repeat value="#{springBookingDao.hotels}" var="hotel">
- <li>#{hotel.name}</li>
- </ui:repeat>
- </ul>
-</body>
-</html>
+</ui:composition>
1.4 +1 -1 jboss-seam/examples/spring/view/index.xhtml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: index.xhtml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/spring/view/index.xhtml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- index.xhtml 18 Feb 2007 19:57:59 -0000 1.3
+++ index.xhtml 19 Feb 2007 19:30:26 -0000 1.4
@@ -10,7 +10,7 @@
<body>
<ul>
<li><s:link view="/strings.xhtml" value="strings example" /></li>
- <li><s:link view="/hotels.xhtml" value="hotel dao" /></li>
+ <li><s:link view="/main.xhtml" value="hotel dao" /></li>
</ul>
</body>
</html>
1.1 date: 2007/02/19 19:30:26; author: nrichards; state: Exp;jboss-seam/examples/spring/view/conversations.xhtml
Index: conversations.xhtml
===================================================================
<!DOCTYPE div PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<div xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:s="http://jboss.com/products/seam/taglib">
<div class="section">
<h1><h:outputText rendered="#{not empty conversationList}" value="Workspaces"/></h1>
</div>
<div class="section">
<h:form>
<h:dataTable value="#{conversationList}" var="entry">
<h:column>
<h:commandLink action="#{entry.select}" value="#{entry.description}"/>
 
<h:outputText value="[current]" rendered="#{entry.current}"/>
</h:column>
<h:column>
<h:outputText value="#{entry.startDatetime}">
<s:convertDateTime type="time" pattern="hh:mm"/>
</h:outputText>
-
<h:outputText value="#{entry.lastDatetime}">
<s:convertDateTime type="time" pattern="hh:mm"/>
</h:outputText>
</h:column>
</h:dataTable>
</h:form>
</div>
</div>
1.1 date: 2007/02/19 19:30:26; author: nrichards; state: Exp;jboss-seam/examples/spring/view/hotel.xhtml
Index: hotel.xhtml
===================================================================
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib"
template="template.xhtml">
<!-- content -->
<ui:define name="content">
<div class="section">
<h1>View Hotel</h1>
</div>
<div class="section">
<div class="entry">
<div class="label">Name:</div>
<div class="output">#{hotel.name}</div>
</div>
<div class="entry">
<div class="label">Address:</div>
<div class="output">#{hotel.address}</div>
</div>
<div class="entry">
<div class="label">City:</div>
<div class="output">#{hotel.city}</div>
</div>
<div class="entry">
<div class="label">State:</div>
<div class="output">#{hotel.state}</div>
</div>
<div class="entry">
<div class="label">Zip:</div>
<div class="output">#{hotel.zip}</div>
</div>
<div class="entry">
<div class="label">Country:</div>
<div class="output">#{hotel.country}</div>
</div>
<div class="entry">
<div class="label">Nightly rate:</div>
<div class="output">
<h:outputText value="#{hotel.price}">
<f:convertNumber type="currency"
currencySymbol="$"/>
</h:outputText>
</div>
</div>
</div>
<div class="section">
<h:form id="hotel">
<fieldset class="buttonBox">
<h:commandButton id="bookHotel" action="#{hotelBooking.bookHotel}" value="Book Hotel"/> 
<h:commandButton id="cancel" action="#{hotelBooking.cancel}" value="Back to Search"/>
</fieldset>
</h:form>
</div>
</ui:define>
<ui:define name="sidebar"> </ui:define>
</ui:composition>
1.1 date: 2007/02/19 19:30:26; author: nrichards; state: Exp;jboss-seam/examples/spring/view/main.xhtml
Index: main.xhtml
===================================================================
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib"
template="template.xhtml">
<!-- content -->
<ui:define name="content">
<div class="section">
<h:form id="main">
<span class="errors">
<h:messages globalOnly="true"/>
</span>
<h1>Search Hotels</h1>
<fieldset>
<h:inputText id="searchString" value="#{hotelSearch.searchString}" style="width: 165px;" />
 
<h:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}" />
 
<br/>
<h:outputLabel for="pageSize">Maximum results:</h:outputLabel> 
<h:selectOneMenu value="#{hotelSearch.pageSize}" id="pageSize">
<f:selectItem itemLabel="5" itemValue="5"/>
<f:selectItem itemLabel="10" itemValue="10"/>
<f:selectItem itemLabel="20" itemValue="20"/>
</h:selectOneMenu>
</fieldset>
</h:form>
</div>
<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:column>
<f:facet name="header">Name</f:facet>
#{hot.name}
</h:column>
<h:column>
<f:facet name="header">Address</f:facet>
#{hot.address}
</h:column>
<h:column>
<f:facet name="header">City, State</f:facet>
#{hot.city}, #{hot.state}, #{hot.country}
</h:column>
<h:column>
<f:facet name="header">Zip</f:facet>
#{hot.zip}
</h:column>
<h:column>
<f:facet name="header">Action</f:facet>
<h:form>
<h:commandLink value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
</h:form>
</h:column>
</h:dataTable>
<s:link value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}"/>
</div>
<div class="section">
<h1>Current Hotel Bookings</h1>
</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}">
<h:column>
<f:facet name="header">Name</f:facet>
#{book.hotel.name}
</h:column>
<h:column>
<f:facet name="header">Address</f:facet>
#{book.hotel.address}
</h:column>
<h:column>
<f:facet name="header">City, State</f:facet>
#{book.hotel.city}, #{book.hotel.state}
</h:column>
<h:column>
<f:facet name="header">Check in date</f:facet>
<h:outputText value="#{book.checkinDate}"/>
</h:column>
<h:column>
<f:facet name="header">Check out date</f:facet>
<h:outputText value="#{book.checkoutDate}"/>
</h:column>
<h:column>
<f:facet name="header">Confirmation number</f:facet>
#{book.id}
</h:column>
<h:column>
<f:facet name="header">Action</f:facet>
<h:commandLink id="cancel" value="Cancel" action="#{bookingList.cancel}"/>
</h:column>
</h:dataTable>
</h:form>
</div>
</ui:define>
<!-- sidebar -->
<ui:define name="sidebar"></ui:define>
</ui:composition>
1.1 date: 2007/02/19 19:30:26; author: nrichards; state: Exp;jboss-seam/examples/spring/view/template.xhtml
Index: template.xhtml
===================================================================
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:s="http://jboss.com/products/seam/taglib">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JBoss Suites: Seam Framework</title>
<link href="css/screen.css" rel="stylesheet" type="text/css" />
<link href="css/date.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="document">
<div id="header">
<div id="title"><img src="img/hdr.title.gif" alt="JBoss Suites: seam framework demo"/></div>
<div id="status">
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"/>
</div>
</div>
<div id="container">
<div id="sidebar">
<ui:insert name="sidebar"/>
</div>
<div id="content">
<ui:insert name="content"/>
<ui:include src="conversations.xhtml" />
</div>
</div>
<div id="footer">Created with JBoss EJB 3.0, Seam, MyFaces, and Facelets</div>
</div>
</body>
</html>
More information about the jboss-cvs-commits
mailing list