[seam-commits] Seam SVN: r10561 - in examples/trunk/booking: seam-booking-ear and 25 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Apr 21 22:21:42 EDT 2009


Author: dan.j.allen
Date: 2009-04-21 22:21:42 -0400 (Tue, 21 Apr 2009)
New Revision: 10561

Added:
   examples/trunk/booking/readme.txt
   examples/trunk/booking/seam-booking-ear/
   examples/trunk/booking/seam-booking-ear/pom.xml
   examples/trunk/booking/seam-booking-ear/src/
   examples/trunk/booking/seam-booking-ear/src/main/
   examples/trunk/booking/seam-booking-ear/src/main/application/
   examples/trunk/booking/seam-booking-ear/src/main/application/seam-booking-ds.xml
   examples/trunk/booking/seam-booking-ejb/
   examples/trunk/booking/seam-booking-ejb/pom.xml
   examples/trunk/booking/seam-booking-ejb/src/
   examples/trunk/booking/seam-booking-ejb/src/main/
   examples/trunk/booking/seam-booking-ejb/src/main/java/
   examples/trunk/booking/seam-booking-ejb/src/main/java/org/
   examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/
   examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/
   examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/
   examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/
   examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/
   examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearch.java
   examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearchBean.java
   examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/SearchCriteria.java
   examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/binding/
   examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/
   examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Booking.java
   examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java
   examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/User.java
   examples/trunk/booking/seam-booking-ejb/src/main/resources/
   examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/
   examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/beans.xml
   examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/persistence.xml
   examples/trunk/booking/seam-booking-ejb/src/main/resources/import.sql
   examples/trunk/booking/seam-booking-ejb/src/test/
   examples/trunk/booking/seam-booking-ejb/src/test/java/
   examples/trunk/booking/seam-booking-war/
   examples/trunk/booking/seam-booking-war/pom.xml
   examples/trunk/booking/seam-booking-war/src/
   examples/trunk/booking/seam-booking-war/src/main/
   examples/trunk/booking/seam-booking-war/src/main/java/
   examples/trunk/booking/seam-booking-war/src/main/webapp/
   examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/
   examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/faces-config.xml
   examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/layout/
   examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/layout/template.xhtml
   examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/web.xml
   examples/trunk/booking/seam-booking-war/src/main/webapp/css/
   examples/trunk/booking/seam-booking-war/src/main/webapp/css/screen.css
   examples/trunk/booking/seam-booking-war/src/main/webapp/favicon.ico
   examples/trunk/booking/seam-booking-war/src/main/webapp/home.xhtml
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/bg.gif
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/btn.bg.gif
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/cal-next.png
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/cal-prev.png
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/cnt.bg.gif
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/dtpick.gif
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.ad.jpg
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.bar.jpg
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.bg.gif
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.title.gif
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/header_line.gif
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/input.bg.gif
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/sdb.bg.gif
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/spinner.gif
   examples/trunk/booking/seam-booking-war/src/main/webapp/img/th.bg.gif
   examples/trunk/booking/seam-booking-war/src/main/webapp/index.html
   examples/trunk/booking/seam-booking-war/src/main/webapp/main.xhtml
Modified:
   examples/trunk/booking/pom.xml
Log:
booking example as an EAR, with hotel search working (mostly)


Modified: examples/trunk/booking/pom.xml
===================================================================
--- examples/trunk/booking/pom.xml	2009-04-22 02:18:08 UTC (rev 10560)
+++ examples/trunk/booking/pom.xml	2009-04-22 02:21:42 UTC (rev 10561)
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
@@ -10,11 +10,63 @@
       <version>3.0.0-SNAPSHOT</version>
    </parent>
 
-   <groupId>org.jboss.seam.examples</groupId>
    <artifactId>seam-booking</artifactId>
-   <packaging>war</packaging>
+   <packaging>pom</packaging>
    <name>Seam Booking Example</name>
+   <description>Seam Booking Example</description>
 
+   <modules>
+      <module>${project.artifactId}-ejb</module>
+      <module>${project.artifactId}-war</module>
+      <module>${project.artifactId}-ear</module>
+   </modules>
+
+   <build>
+      <defaultGoal>package</defaultGoal>
+      <pluginManagement>
+         <plugins>
+
+            <plugin>
+               <groupId>org.apache.maven.plugins</groupId>
+               <artifactId>maven-compiler-plugin</artifactId>
+               <configuration>
+                  <source>1.5</source>
+                  <target>1.5</target>
+               </configuration>
+            </plugin>
+
+            <plugin>
+               <groupId>org.apache.maven.plugins</groupId>
+               <artifactId>maven-ejb-plugin</artifactId>
+               <configuration>
+                  <ejbVersion>3.0</ejbVersion>
+               </configuration>
+            </plugin>
+
+         </plugins>
+      </pluginManagement>
+   </build>
+
+   <dependencyManagement>
+      <dependencies>
+
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>seam-booking-ejb</artifactId>
+            <version>${project.version}</version>
+            <type>ejb</type>
+        </dependency>
+
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>seam-booking-war</artifactId>
+            <version>${project.version}</version>
+            <type>war</type>
+        </dependency>
+
+      </dependencies>
+   </dependencyManagement>
+
    <dependencies>
 
       <dependency>
@@ -24,43 +76,6 @@
          <classifier>jdk15</classifier>
       </dependency>
 
-      <dependency>
-         <groupId>org.jboss.webbeans</groupId>
-         <artifactId>jsr299-api</artifactId>
-         <scope>provided</scope>
-      </dependency>
-
-      <dependency>
-         <groupId>javax.faces</groupId>
-         <artifactId>jsf-api</artifactId>
-         <scope>provided</scope>
-      </dependency>
-
-      <dependency>
-         <groupId>com.sun.facelets</groupId>
-         <artifactId>jsf-facelets</artifactId>
-      </dependency>
-
-      <dependency>
-         <groupId>org.jboss.el</groupId>
-         <artifactId>jboss-el</artifactId>
-         <exclusions>
-            <exclusion>
-               <groupId>javax.el</groupId>
-               <artifactId>el-api</artifactId>
-            </exclusion>
-         </exclusions>
-      </dependency>
-
-      <dependency>
-         <groupId>javax.annotation</groupId>
-         <artifactId>jsr250-api</artifactId>
-      </dependency>
-
    </dependencies>
 
-   <build>
-      <finalName>seam-booking</finalName>
-   </build>
-
 </project>

Added: examples/trunk/booking/readme.txt
===================================================================
--- examples/trunk/booking/readme.txt	                        (rev 0)
+++ examples/trunk/booking/readme.txt	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,38 @@
+Seam Booking Example
+====================
+
+This example demonstrates the use of Seam 3 in a Java EE 6 environment (or a
+Java EE 5 environment enhanced with JSR-299 [Web Beans] and JSF 2.0).
+Contextual state management and dependency injection are handled by JSR-299.
+Transaction and persistence context management is handled by the EJB 3
+container.
+
+Please consult the Web Beans reference documentation for instructions on how to
+deploy the Web Bean implementation to JBoss AS 5. To upgrade the JSF libraries
+to JSF 2.0, go to the Seam jsf-updater-tool module and follow the instructions
+there.
+
+This example uses a Maven 2 build. To build the EJB and WAR and package them
+inside an EAR, execute the following command:
+
+ mvn
+
+Then, set the JBOSS_HOME environment variable to the location of a JBoss AS 5
+installation. Once that's done, execute the following command to deploy the
+application to JBoss AS via JMX:
+
+ mvn -f seam-booking-ear/pom.xml jboss:deploy
+
+You can undeploy the application via JMX using this command:
+
+ mvn -f seam-booking-ear/pom.xml jboss:undeploy
+
+Here's the restart (mega) command:
+
+mvn -f seam-booking-ear/pom.xml jboss:undeploy && mvn package && mvn -f seam-booking-ear/pom.xml jboss:deploy
+
+If you would rather deploy more traditional way by copying the archive directly
+to the deploy directory of the JBoss AS domain, use this command instead:
+
+ mvn -f seam-booking-ear/pom.xml jboss:harddeploy
+

Added: examples/trunk/booking/seam-booking-ear/pom.xml
===================================================================
--- examples/trunk/booking/seam-booking-ear/pom.xml	                        (rev 0)
+++ examples/trunk/booking/seam-booking-ear/pom.xml	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+
+   <parent>
+      <groupId>org.jboss.seam.examples</groupId>
+      <artifactId>seam-booking</artifactId>
+      <version>3.0.0-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>seam-booking-ear</artifactId>
+   <packaging>ear</packaging>
+   <name>Seam Booking Example (Enterprise application)</name>
+
+   <build>
+      <defaultGoal>package</defaultGoal>
+      <finalName>${project.parent.artifactId}</finalName>
+      <plugins>
+
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-ear-plugin</artifactId>
+            <version>2.3.2</version> <!-- why is this not inheriting? w/o it I get 2.3.1! -->
+            <configuration>
+               <defaultJavaBundleDir>lib</defaultJavaBundleDir>
+               <jboss>
+                  <version>4.2</version>
+                  <!-- If you use loader-repository, it will break Web Beans -->
+                  <!--<loader-repository>${project.groupId}:loader=${project.build.finalName}</loader-repository>-->
+                  <data-sources>
+                     <data-source>${project.parent.artifactId}-ds.xml</data-source>
+                  </data-sources>
+               </jboss>
+               <modules>
+                  <webModule>
+                     <groupId>${project.groupId}</groupId>
+                     <artifactId>seam-booking-war</artifactId>
+                     <contextRoot>/seam-booking</contextRoot>
+                  </webModule>
+               </modules>
+            </configuration>
+         </plugin>
+
+      </plugins>
+   </build>
+
+   <dependencies>
+
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>${project.parent.artifactId}-ejb</artifactId>
+            <type>ejb</type>
+        </dependency>
+
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>${project.parent.artifactId}-war</artifactId>
+            <type>war</type>
+        </dependency>
+
+   </dependencies>
+</project>

Added: examples/trunk/booking/seam-booking-ear/src/main/application/seam-booking-ds.xml
===================================================================
--- examples/trunk/booking/seam-booking-ear/src/main/application/seam-booking-ds.xml	                        (rev 0)
+++ examples/trunk/booking/seam-booking-ear/src/main/application/seam-booking-ds.xml	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE datasources
+   PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
+   "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
+<datasources>
+
+    <local-tx-datasource>
+        <jndi-name>bookingDatasource</jndi-name>
+        <use-java-context>false</use-java-context>
+        <connection-url>jdbc:hsqldb:.</connection-url>
+        <driver-class>org.hsqldb.jdbcDriver</driver-class>
+        <user-name>sa</user-name>
+        <password></password>
+    </local-tx-datasource>
+
+</datasources>

Added: examples/trunk/booking/seam-booking-ejb/pom.xml
===================================================================
--- examples/trunk/booking/seam-booking-ejb/pom.xml	                        (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/pom.xml	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+
+   <parent>
+      <groupId>org.jboss.seam.examples</groupId>
+      <artifactId>seam-booking</artifactId>
+      <version>3.0.0-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>seam-booking-ejb</artifactId>
+   <packaging>ejb</packaging>
+   <name>Seam Booking Example (EJB module)</name>
+
+   <build>
+      <finalName>${project.artifactId}</finalName>
+   </build>
+
+   <dependencies>
+
+      <dependency>
+         <groupId>javax.annotation</groupId>
+         <artifactId>jsr250-api</artifactId>
+         <scope>provided</scope>
+      </dependency>
+
+      <dependency>
+         <groupId>javax.ejb</groupId>
+         <artifactId>ejb-api</artifactId>
+         <scope>provided</scope>
+      </dependency>
+
+      <dependency>
+         <groupId>javax.persistence</groupId>
+         <artifactId>persistence-api</artifactId>
+         <scope>provided</scope>
+      </dependency>
+
+      <dependency>
+         <groupId>javax.validation</groupId>
+         <artifactId>validation-api</artifactId>
+         <scope>provided</scope>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.webbeans</groupId>
+         <artifactId>jsr299-api</artifactId>
+         <scope>provided</scope>
+      </dependency>
+
+   </dependencies>
+
+</project>

Added: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearch.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearch.java	                        (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearch.java	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,24 @@
+package org.jboss.seam.examples.booking.action;
+
+import java.util.List;
+import javax.ejb.Local;
+import org.jboss.seam.examples.booking.model.Hotel;
+
+public
+ at Local
+interface HotelSearch
+{
+   public void find();
+
+   public void previousPage();
+
+   public void nextPage();
+
+   public List<Hotel> getHotels();
+
+   public boolean isNextPageAvailable();
+
+   public boolean isPreviousPageAvailable();
+
+   public void destroy();
+}

Added: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearchBean.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearchBean.java	                        (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearchBean.java	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,90 @@
+package org.jboss.seam.examples.booking.action;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.Named;
+import javax.context.RequestScoped;
+import javax.context.SessionScoped;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.inject.Current;
+import javax.inject.Produces;
+import javax.inject.manager.Manager;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import org.jboss.seam.examples.booking.model.Hotel;
+
+public
+ at Named("hotelSearch")
+ at Stateful
+ at SessionScoped
+class HotelSearchBean implements HotelSearch
+{
+   @Current Manager manager;
+   @Current SearchCriteria criteria;
+
+   private @PersistenceContext EntityManager em;
+   private boolean nextPageAvailable = false;
+   private List<Hotel> hotels = new ArrayList<Hotel>();
+
+   public void find()
+   {
+      criteria.firstPage();
+      queryHotels(criteria);
+   }
+
+   public void nextPage()
+   {
+      criteria.nextPage();
+      queryHotels(criteria);
+   }
+
+   public void previousPage()
+   {
+      criteria.previousPage();
+      queryHotels(criteria);
+   }
+
+   public
+   @Produces
+   @Named
+   @RequestScoped
+   List<Hotel> getHotels()
+   {
+      return hotels;
+   }
+
+   public boolean isNextPageAvailable()
+   {
+      return nextPageAvailable;
+   }
+
+   public boolean isPreviousPageAvailable()
+   {
+      return criteria.getPage() > 0;
+   }
+
+   @Remove
+   public void destroy()
+   {
+   }
+
+   private void queryHotels(SearchCriteria criteria)
+   {
+      List<Hotel> results = em.createQuery(
+         "select h from Hotel h where lower(h.name) like :pattern or lower(h.city) like :pattern or lower(h.zip) like :pattern or lower(h.address) like :pattern").
+         setParameter("pattern", criteria.getSearchPattern()).setMaxResults(criteria.getPageSize() + 1).setFirstResult(criteria.getPage() * criteria.getPageSize()).
+         getResultList();
+
+      System.out.println("Found " + results.size() + " hotels");
+      nextPageAvailable = results.size() > criteria.getPageSize();
+      if (nextPageAvailable)
+      {
+         hotels = new ArrayList<Hotel>(results.subList(0, criteria.getPageSize()));
+      }
+      else
+      {
+         hotels = results;
+      }
+   }
+}

Added: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/SearchCriteria.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/SearchCriteria.java	                        (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/SearchCriteria.java	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,66 @@
+package org.jboss.seam.examples.booking.action;
+
+import java.io.Serializable;
+import javax.annotation.Named;
+import javax.context.SessionScoped;
+
+public
+ at Named
+ at SessionScoped
+class SearchCriteria implements Serializable
+{
+   private String searchString = "";
+   private int pageSize = 5;
+   private int page = 0;
+
+   public String getSearchPattern() {
+      return searchString == null ? "%" : '%' + searchString.toLowerCase().replace('*', '%') + '%';
+   }
+
+   public int getPage()
+   {
+      return page;
+   }
+
+   public void setPage(int page)
+   {
+      this.page = page;
+   }
+
+   public int getPageSize()
+   {
+      return pageSize;
+   }
+
+   public void setPageSize(int pageSize)
+   {
+      this.pageSize = pageSize;
+   }
+
+   public String getSearchString()
+   {
+      return searchString;
+   }
+
+   public void setSearchString(String searchString)
+   {
+      this.searchString = searchString;
+   }
+
+   public void nextPage()
+   {
+      page++;
+   }
+
+   public void previousPage()
+   {
+      if (page > 0) {
+         page--;
+      }
+   }
+
+   public void firstPage()
+   {
+      page = 0;
+   }
+}

Added: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Booking.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Booking.java	                        (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Booking.java	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,227 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.model;
+
+import static javax.persistence.TemporalType.DATE;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.util.Date;
+
+import javax.persistence.Basic;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+
+/**
+ * <p><strong>Booking</strong> is the model/entity class that represents a hotel
+ * booking.</p>
+ *
+ * @author Gavin King
+ * @author Dan Allen
+ */
+public
+ at Entity
+class Booking implements Serializable
+{
+   private Long id;
+   private User user;
+   private Hotel hotel;
+   private Date checkinDate;
+   private Date checkoutDate;
+   private String creditCard;
+   private String creditCardName;
+   private int creditCardExpiryMonth;
+   private int creditCardExpiryYear;
+   private boolean smoking;
+   private int beds;
+
+   public Booking()
+   {
+   }
+
+   public Booking(Hotel hotel, User user)
+   {
+      this.hotel = hotel;
+      this.user = user;
+   }
+
+   @Transient
+   public BigDecimal getTotal()
+   {
+      return hotel.getPrice().multiply(new BigDecimal(getNights()));
+   }
+
+   @Transient
+   public int getNights()
+   {
+      return (int) (checkoutDate.getTime() - checkinDate.getTime()) / 1000 / 60 / 60 / 24;
+   }
+
+   @Id
+   @GeneratedValue
+   public Long getId()
+   {
+      return id;
+   }
+
+   public void setId(Long id)
+   {
+      this.id = id;
+   }
+
+   @NotNull
+   @Basic
+   @Temporal(DATE)
+   public Date getCheckinDate()
+   {
+      return checkinDate;
+   }
+
+   public void setCheckinDate(Date datetime)
+   {
+      this.checkinDate = datetime;
+   }
+
+   @ManyToOne
+   @NotNull
+   public Hotel getHotel()
+   {
+      return hotel;
+   }
+
+   public void setHotel(Hotel hotel)
+   {
+      this.hotel = hotel;
+   }
+
+   @ManyToOne
+   @NotNull
+   public User getUser()
+   {
+      return user;
+   }
+
+   public void setUser(User user)
+   {
+      this.user = user;
+   }
+
+   @Basic
+   @Temporal(TemporalType.DATE)
+   @NotNull
+   public Date getCheckoutDate()
+   {
+      return checkoutDate;
+   }
+
+   public void setCheckoutDate(Date checkoutDate)
+   {
+      this.checkoutDate = checkoutDate;
+   }
+
+   @NotNull(message = "Credit card number is required")
+   @Size(min = 16, max = 16, message = "Credit card number must 16 digits long")
+   @Pattern(regexp = "^\\d*$", message = "Credit card number must be numeric")
+   public String getCreditCard()
+   {
+      return creditCard;
+   }
+
+   public void setCreditCard(String creditCard)
+   {
+      this.creditCard = creditCard;
+   }
+
+   @Transient
+   public String getDescription()
+   {
+      DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
+      return hotel == null ? null : hotel.getName() +
+         ", " + df.format(getCheckinDate()) +
+         " to " + df.format(getCheckoutDate());
+   }
+
+   public boolean isSmoking()
+   {
+      return smoking;
+   }
+
+   public void setSmoking(boolean smoking)
+   {
+      this.smoking = smoking;
+   }
+
+   public int getBeds()
+   {
+      return beds;
+   }
+
+   public void setBeds(int beds)
+   {
+      this.beds = beds;
+   }
+
+   @NotNull(message = "Credit card name is required")
+   @Size(min = 3, max = 70, message = "Credit card name is required")
+   public String getCreditCardName()
+   {
+      return creditCardName;
+   }
+
+   public void setCreditCardName(String creditCardName)
+   {
+      this.creditCardName = creditCardName;
+   }
+
+   public int getCreditCardExpiryMonth()
+   {
+      return creditCardExpiryMonth;
+   }
+
+   public void setCreditCardExpiryMonth(int creditCardExpiryMonth)
+   {
+      this.creditCardExpiryMonth = creditCardExpiryMonth;
+   }
+
+   public int getCreditCardExpiryYear()
+   {
+      return creditCardExpiryYear;
+   }
+
+   public void setCreditCardExpiryYear(int creditCardExpiryYear)
+   {
+      this.creditCardExpiryYear = creditCardExpiryYear;
+   }
+
+   @Override
+   public String toString()
+   {
+      return "Booking(" + user + "," + hotel + ")";
+   }
+}

Added: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java	                        (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.model;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+/**
+ * <p><strong>Hotel</strong> is the model/entity class that represents a hotel.</p>
+ *
+ * @author Gavin King
+ * @author Dan Allen
+ */
+public
+ at Entity
+class Hotel implements Serializable
+{
+   private Long id;
+   private String name;
+   private String address;
+   private String city;
+   private String state;
+   private String zip;
+   private String country;
+   private BigDecimal price;
+
+   @Id
+   @GeneratedValue
+   public Long getId()
+   {
+      return id;
+   }
+
+   public void setId(Long id)
+   {
+      this.id = id;
+   }
+
+   @Size(max = 50)
+   @NotNull
+   public String getName()
+   {
+      return name;
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   @Size(max = 100)
+   @NotNull
+   public String getAddress()
+   {
+      return address;
+   }
+
+   public void setAddress(String address)
+   {
+      this.address = address;
+   }
+
+   @Size(max = 40)
+   @NotNull
+   public String getCity()
+   {
+      return city;
+   }
+
+   public void setCity(String city)
+   {
+      this.city = city;
+   }
+
+   @Size(min = 4, max = 6)
+   @NotNull
+   public String getZip()
+   {
+      return zip;
+   }
+
+   public void setZip(String zip)
+   {
+      this.zip = zip;
+   }
+
+   @Size(min = 2, max = 10)
+   @NotNull
+   public String getState()
+   {
+      return state;
+   }
+
+   public void setState(String state)
+   {
+      this.state = state;
+   }
+
+   @Size(min = 2, max = 40)
+   @NotNull
+   public String getCountry()
+   {
+      return country;
+   }
+
+   public void setCountry(String country)
+   {
+      this.country = country;
+   }
+
+   @Column(precision = 6, scale = 2)
+   public BigDecimal getPrice()
+   {
+      return price;
+   }
+
+   public void setPrice(BigDecimal price)
+   {
+      this.price = price;
+   }
+
+   @Override
+   public String toString()
+   {
+      return "Hotel(" + name + "," + address + "," + city + "," + zip + ")";
+   }
+}

Added: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/User.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/User.java	                        (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/User.java	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.model;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+
+/**
+ * <p><strong>User</strong> is the model/entity class that represents a customer
+ * who may book a hotel.</p>
+ *
+ * @author Gavin King
+ * @author Dan Allen
+ */
+public
+ at Entity
+ at Table(name = "Customer")
+class User implements Serializable
+{
+   private String username;
+   private String password;
+   private String name;
+
+   public User(String name, String password, String username)
+   {
+      this.name = name;
+      this.password = password;
+      this.username = username;
+   }
+
+   public User()
+   {
+   }
+
+   @NotNull
+   @Size(max = 100)
+   public String getName()
+   {
+      return name;
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   @NotNull
+   @Size(min = 5, max = 15)
+   public String getPassword()
+   {
+      return password;
+   }
+
+   public void setPassword(String password)
+   {
+      this.password = password;
+   }
+
+   @Id
+   @Size(min = 4, max = 15)
+   @Pattern(regexp = "^\\w*$", message = "not a valid username")
+   public String getUsername()
+   {
+      return username;
+   }
+
+   public void setUsername(String username)
+   {
+      this.username = username;
+   }
+
+   @Override
+   public String toString()
+   {
+      return "User(" + username + ")";
+   }
+}

Added: examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/beans.xml
===================================================================

Added: examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/persistence.xml
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/persistence.xml	                        (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/persistence.xml	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" 
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" 
+   version="1.0">
+   <persistence-unit name="booking">
+      <provider>org.hibernate.ejb.HibernatePersistence</provider>
+      <jta-data-source>bookingDatasource</jta-data-source>
+      <properties>
+         <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+         <property name="hibernate.show_sql" value="true"/>
+         <!-- These are the default for JBoss EJB 3, but not for Hibernate EntityManager -->
+         <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
+         <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
+      </properties>
+   </persistence-unit>
+</persistence>

Added: examples/trunk/booking/seam-booking-ejb/src/main/resources/import.sql
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/resources/import.sql	                        (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/resources/import.sql	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,24 @@
+insert into Customer (username, password, name) values ('gavin', 'mexico', 'Gavin King')
+insert into Customer (username, password, name) values ('pete', 'edinburgh', 'Pete Muir')
+insert into Customer (username, password, name) values ('shane', 'brisbane', 'Shane Bryzak')
+insert into Customer (username, password, name) values ('dan', 'maryland', 'Dan Allen')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (1, 120, 'Marriott Courtyard', 'Tower Place, Buckhead', 'Atlanta', 'GA', '30305', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (2, 180, 'Doubletree', 'Tower Place, Buckhead', 'Atlanta', 'GA', '30305', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (3, 450, 'W Hotel', 'Union Square, Manhattan', 'NY', 'NY', '10011', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (4, 450, 'W Hotel', 'Lexington Ave, Manhattan', 'NY', 'NY', '10011', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (5, 250, 'Hotel Rouge', '1315 16th Street NW', 'Washington', 'DC', '20036', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (6, 300, '70 Park Avenue Hotel', '70 Park Avenue', 'NY', 'NY', '10011', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (8, 300, 'Conrad Miami', '1395 Brickell Ave', 'Miami', 'FL', '33131', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (9, 80, 'Sea Horse Inn', '2106 N Clairemont Ave', 'Eau Claire', 'WI', '54703', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (10, 90, 'Super 8 Eau Claire Campus Area', '1151 W Macarthur Ave', 'Eau Claire', 'WI', '54701', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (11, 160, 'Marriot Downtown', '55 Fourth Street', 'San Francisco', 'CA', '94103', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (12, 200, 'Hilton Diagonal Mar', 'Passeig del Taulat 262-264', 'Barcelona', 'Catalunya', '08019', 'Spain')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (13, 210, 'Hilton Tel Aviv', 'Independence Park', 'Tel Aviv', '', '63405', 'Israel')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (14, 240, 'InterContinental Tokyo Bay', 'Takeshiba Pier', 'Tokyo', '', '105', 'Japan')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (15, 130, 'Hotel Beaulac', ' Esplanade Léopold-Robert 2', 'Neuchatel', '', '2000', 'Switzerland')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (16, 140, 'Conrad Treasury Place', 'William & George Streets', 'Brisbane', 'QLD', '4001', 'Australia')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (17, 230, 'Ritz Carlton', '1228 Sherbrooke St', 'West Montreal', 'Quebec', 'H3G1H6', 'Canada')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (18, 460, 'Ritz Carlton', 'Peachtree Rd, Buckhead', 'Atlanta', 'GA', '30326', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (19, 220, 'Swissotel', '68 Market Street', 'Sydney', 'NSW', '2000', 'Australia')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (20, 250, 'Meliá White House', 'Albany Street', 'Regents Park London', '', 'NW13UP', 'Great Britain')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (21, 210, 'Hotel Allegro', '171 West Randolph Street', 'Chicago', 'IL', '60601', 'USA')

Added: examples/trunk/booking/seam-booking-war/pom.xml
===================================================================
--- examples/trunk/booking/seam-booking-war/pom.xml	                        (rev 0)
+++ examples/trunk/booking/seam-booking-war/pom.xml	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+
+   <parent>
+      <groupId>org.jboss.seam.examples</groupId>
+      <artifactId>seam-booking</artifactId>
+      <version>3.0.0-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>seam-booking-war</artifactId>
+   <packaging>war</packaging>
+   <name>Seam Booking Example (Web module)</name>
+
+   <build>
+      <defaultGoal>package</defaultGoal>
+      <finalName>${project.parent.artifactId}</finalName>
+   </build>
+
+   <dependencies>
+
+      <!--
+      <dependency>
+         <groupId>com.sun.facelets</groupId>
+         <artifactId>jsf-facelets</artifactId>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.el</groupId>
+         <artifactId>jboss-el</artifactId>
+         <exclusions>
+            <exclusion>
+               <groupId>javax.el</groupId>
+               <artifactId>el-api</artifactId>
+            </exclusion>
+         </exclusions>
+      </dependency>
+      -->
+
+      <dependency>
+         <groupId>javax.el</groupId>
+         <artifactId>el-ri</artifactId>
+         <exclusions>
+            <exclusion>
+               <groupId>javax.el</groupId>
+               <artifactId>el-api</artifactId>
+            </exclusion>
+         </exclusions>
+      </dependency>
+      
+   </dependencies>
+
+</project>

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/faces-config.xml	                        (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/faces-config.xml	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+   version="2.0">
+    
+   <application>
+      <!--
+      <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+      -->
+   </application>
+
+   <navigation-rule>
+	   <!-- navigation rules are required to reset request-scoped producer variables -->
+	   <from-view-id>/main.xhtml</from-view-id>
+	   <navigation-case>
+		   <from-action>#{hotelSearch.find}</from-action>
+		   <to-view-id>/main.xhtml</to-view-id>
+		   <if>#{true}</if>
+		   <redirect/>
+	   </navigation-case>
+	   <navigation-case>
+		   <from-action>#{hotelSearch.nextPage}</from-action>
+		   <to-view-id>/main.xhtml</to-view-id>
+		   <if>#{true}</if>
+		   <redirect/>
+	   </navigation-case>
+   </navigation-rule>
+
+</faces-config>

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/layout/template.xhtml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/layout/template.xhtml	                        (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/layout/template.xhtml	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,41 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<f:view 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"
+   contentType="text/html">
+<html>
+   <head>
+      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+      <title>JBoss Suites: Seam Framework</title>
+      <link rel="shortcut icon" href="#{request.contextPath}/favicon.ico"/>
+      <link href="#{request.contextPath}/css/screen.css" rel="stylesheet" type="text/css"/>
+   </head>
+   <body>
+      <div id="document">
+         <div id="header">
+            <div id="title"><h:graphicImage value="/img/hdr.title.gif" alt="JBoss Suites: seam framework demo"/></div>
+            <div id="status">
+               <h:link id="search" outcome="/main.xhtml" value="Search"/>
+               <ui:remove><!--
+               Welcome #{user.name}
+               | <h:link id="search" outcome="/main.xhtml" value="Search"/>
+               | <h:link id="settings" outcome="/password.xhtml" value="Settings"/>
+               | <s:link id="logout" action="#{identity.logout}" value="Logout"/>
+               --></ui:remove>
+            </div>
+         </div>
+         <div id="container">
+            <div id="sidebar">
+               <ui:insert name="sidebar"/>
+            </div>
+            <div id="content">
+               <ui:insert name="content"/>
+            </div>
+         </div>
+         <div id="footer">Created with Seam 3.0, Web Beans, EJB 3.0 and JSF 2.0</div>
+      </div>
+   </body>
+</html>
+</f:view>

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/web.xml	                        (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/web.xml	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+   version="2.5">
+
+   <display-name>Seam Booking Example</display-name>
+   
+   <context-param>
+      <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+      <param-value>.xhtml</param-value>
+   </context-param>
+   
+   <context-param>
+      <param-name>facelets.DEVELOPMENT</param-name>
+      <param-value>true</param-value>
+   </context-param>
+   
+   <servlet>
+      <servlet-name>Faces Servlet</servlet-name>
+      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+      <load-on-startup>1</load-on-startup>
+   </servlet>
+   
+   <servlet-mapping>
+      <servlet-name>Faces Servlet</servlet-name>
+      <url-pattern>*.seam</url-pattern>
+   </servlet-mapping>
+
+   <session-config>
+      <session-timeout>10</session-timeout> 
+   </session-config>   
+   
+</web-app>

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/css/screen.css
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/css/screen.css	                        (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/css/screen.css	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,278 @@
+/* Setup defaults since variable in browsers
+----------------------------------------------- */
+body, div, span, dd, dt, dl, img, ul, ol, li, p, h1, h2, h3, h4, h5, form, hr, fieldset {
+	margin: 0;
+	padding: 0;
+}
+/* Element Defaults
+----------------------------------------------- */
+html {
+	height: 100%;
+	background-color: #DBD4C6;
+}
+img {
+	border: 0;
+}
+body {
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: small;
+	line-height: 1.25em;
+	color: #362F2D;
+	position: relative;
+	width: 760px;
+	height: 100%;
+	margin-left: auto;
+	margin-right: auto;
+}
+.label {
+	font-weight: bold;
+	color: #5E5147;
+}
+input {
+	border: 1px solid #C3BBB6;
+	padding: 4px;
+	margin: 5px 0;
+	background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
+}
+select {
+	border: 1px solid #C3BBB6;
+	padding: 4px;
+	margin: 5px 0;
+	background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
+}
+ol, ul {
+	margin: 10px 0px 10px 6px;
+}
+li {
+	margin: 10px 12px;
+}
+fieldset {
+	border: 0;
+}
+/* Layout
+----------------------------------------------- */
+#document {
+	padding: 0 1px;
+	background: #fff url(../img/bg.gif) 0 0 repeat-y;
+	float: left;
+	border-bottom: 1px solid #C3BBB6;
+}
+#header {
+	float: left;
+	width: 758px;
+	height: 46px;
+	background: url(../img/hdr.bg.gif) 0 0 repeat-x;
+}
+#container {
+	float: left;
+	width: 758px;
+	background: url(../img/hdr.bar.jpg) 0 0 repeat-x;
+}
+#sidebar {
+	float: left;
+	width: 190px;
+	margin-top: 96px;
+	padding: 20px 10px 0 10px;
+	background: url(../img/sdb.bg.gif) 0 0 no-repeat;
+}
+#content {
+	float: left;
+	width: 548px;
+	margin-top: 75px;
+	padding-top: 5px;
+	background: #fff url(../img/cnt.bg.gif) 0 0 repeat-x;
+}
+#footer {
+	clear: both;
+	margin-top: 40px;
+	float: left;
+	padding: 20px;
+	border-top: 1px solid #C3BBB6;
+	background-color: #fff;
+	width: 718px;
+	text-align: right;
+}
+/* General
+----------------------------------------------- */
+input[type="submit"], input[type="button"] {
+	font-weight: bold;
+	color: #fff;
+	border: 1px solid #5D1414;
+	height: 26px;
+	background: #fff url(../img/btn.bg.gif) 0 0 repeat-x;
+	border-style: none;
+}
+.center {
+	text-align: center;
+}
+.entry {
+	clear: both;
+	padding-top: 10px;
+}
+.entry .label {
+	float: left;
+	padding-right: 5px;
+	font-weight: bold;
+	width: 150px;
+	text-align: right;
+}
+.entry .output {
+	float: right;
+	width: 360px;
+	padding-top: 10px;
+	text-align: left;
+}
+.entry .input {
+	float: right;
+	width: 360px;
+	text-align: left;
+}
+.entry .error {
+	float: right;
+	width: 360px;
+	text-align: left;
+}
+/* Sidebar
+----------------------------------------------- */
+.notes {
+	text-align: center;
+	font-size: small;
+}
+.subnotes {
+    margin-top: 1em;
+	font-size: small;
+}
+.errors {
+	font-size: small;
+	font-weight: bold;
+	text-align: center;
+	color: #600;
+}
+.errors div {
+	text-align: left;
+}
+.errors span {
+	text-align: left;
+}
+.errors input {
+	border: 1px solid #600;
+}
+.errors ul {
+	list-style: none;
+}
+.buttonBox {
+	text-align: center;
+	padding: 5px 0;
+	clear: both;
+}
+#sidebar p {
+	font-size: small;
+	color: #8B7869;
+	line-height: 150%;
+	padding-bottom: 10px;
+}
+#sidebar li {
+	font-size: small;
+	color: #8B7869;
+}
+#sidebar h1 {
+	line-height: normal;
+	font-weight: bold;
+	font-size: small;
+}
+/*
+#sidebar p:hover {
+	color: #362F2D;
+}
+*/
+/* Content
+----------------------------------------------- */
+#content .section {
+	float: left;
+	width: 518px;
+	padding: 15px 15px 0 15px;
+}
+#content .section h1 {
+	font-family: "Trebuchet MS", Arial, sans-serif;
+	line-height: normal;
+	font-weight: normal;
+	font-size: large;
+}
+#content .section p {
+	line-height: 150%;
+	padding: 10px 0;
+	font-size: small;
+}
+#content table {
+	width: 100%;
+	border: 1px solid #D2C9C4;
+	border-collapse: collapse;
+}
+#content table caption {
+	padding-bottom: 6px;
+	text-align: left;
+	font-weight: bold;
+}
+#content table thead th {
+	border-left: 1px solid #D2C9C4;
+	background: #fff url(../img/th.bg.gif) 0 100% repeat-x;	
+	border-bottom: 1px solid #D2C9C4;
+	padding: 6px;
+	text-align: left;
+	font-size: small;
+}
+#content table tbody td {
+	border-left: 1px solid #E4DBD5;
+	padding: 4px;
+	border-bottom: 1px solid #D2C9C4;
+	font-size: small;
+}
+#content dt {
+	font-weight: bold;
+	float: left;
+	width: 33%;
+}
+#content dd {
+	padding-left: 10px;
+	float: left;
+	width: 66%;
+}
+#content table.radio {
+	border: 0px;
+}
+#content table.radio tbody tr td {
+	border: 0px;
+	border-left: 0px;
+	border-bottom: 0px;
+}
+/* Header
+----------------------------------------------- */
+#title {
+	float: left;
+	padding: 1px 0 6px 15px;
+}
+#status {
+	color: #C7B299;
+	float: right;
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	font-size: x-small;
+	text-align: right;
+	padding-top: 14px;
+	padding-right: 15px;
+}
+#status a {
+	color: #C7B299;
+	text-decoration: none;
+}
+/* Homepage Modifications
+----------------------------------------------- */
+#pgHome #container {
+	background: url(../img/hdr.ad.jpg) 0 0 repeat-x;
+}
+#pgHome #sidebar {
+	margin-top: 207px;
+}
+#pgHome #content {
+	margin-top: 183px;
+}

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/favicon.ico
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/favicon.ico
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/home.xhtml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/home.xhtml	                        (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/home.xhtml	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,87 @@
+<!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:f="http://java.sun.com/jsf/core">
+   <head>
+      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
+      <title>JBoss Suites: Seam Framework</title>
+      <link rel="shortcut icon" href="#{request.contextPath}/favicon.ico"/>
+      <link href="#{request.contextPath}/css/screen.css" rel="stylesheet" type="text/css"/>
+   </head>
+   <body id="pgHome">
+      <f:view>
+         <div id="document">
+            <div id="header">
+               <div id="title"><h:graphicImage value="/img/hdr.title.gif" alt="JBoss Suites: seam framework demo"/></div>
+            </div>
+            <div id="container">
+               <div id="sidebar">
+                  <h:link id="search" outcome="/main.xhtml" value="Search"/>
+                  <ui:remove>
+                  <h:form id="login">
+                  <fieldset>
+                     <div>
+                        <h:outputLabel id="UsernameLabel" for="username">Login Name</h:outputLabel>
+                        <h:inputText id="username" value="#{identity.username}" style="width: 175px;"/>
+                        <div class="errors"><h:message id="UsernameMessage" for="username"/></div>
+                     </div>
+                     <div>
+                        <h:outputLabel id="PasswordLabel" for="password">Password</h:outputLabel>
+                        <h:inputSecret id="password" value="#{identity.password}" style="width: 175px;"/>
+                     </div>
+                     <div class="errors"><h:messages id="messages" globalOnly="true"/></div>
+                     <div class="buttonBox"><h:commandButton id="login" action="#{identity.login}" value="Account Login"/></div>
+                     <div class="notes"><!--<h:link id="register" outcome="/register.xhtml" value="Register New User"/>--></div>
+                         <div class="subnotes">
+                             Or use a demo account:
+                             <ul>
+                                 <li>gavin/mexico</li>
+                                 <li>pete/edinburgh</li>
+                                 <li>shane/brisbane</li>
+                                 <li>dan/maryland</li>
+                             </ul>
+                         </div>
+                  </fieldset>
+                  </h:form>
+                  </ui:remove>
+               </div>
+               <div id="content">
+                  <div class="section">
+                     
+                      <h1>About this example application</h1>
+                      
+                      <p>
+                         This sample application demonstrates how easy it is to develop stateful web 
+                         applications using JBoss Seam. Just register, login, and book a room to see 
+                         Seam in action. Throughout the application you'll see popup links like 
+                         the ones at the bottom of this page. Click them to see how the application 
+                         works under the hood.
+                      </p>
+                      
+                      <p>
+                         Note: Please do NOT enter personal information or your credit card number in 
+                         this sample application.
+                      </p>
+                      
+                      <p>
+                         <a href="#" onclick="window.open('exp/introExp.html','exp','width=752,height=500,scrollbars=yes');">
+                            What is JBoss Seam?
+                         </a>
+                      </p>
+                      
+                      <p>
+                         <a href="#" onclick="window.open('exp/loginExp.html','exp','width=752,height=500,scrollbars=yes');">
+                            What happens when I login?
+                         </a>
+                      </p>
+                                 
+                  </div>
+               </div>
+            </div>
+            <div id="footer">Created with Seam 3.0, Web Beans, EJB 3.0 and JSF 2.0</div>
+         </div>
+      </f:view>
+   </body>
+</html>

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/bg.gif
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/bg.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/btn.bg.gif
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/btn.bg.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/cal-next.png
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/cal-next.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/cal-prev.png
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/cal-prev.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/cnt.bg.gif
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/cnt.bg.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/dtpick.gif
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/dtpick.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.ad.jpg
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.ad.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.bar.jpg
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.bar.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.bg.gif
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.bg.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.title.gif
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.title.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/header_line.gif
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/header_line.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/input.bg.gif
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/input.bg.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/sdb.bg.gif
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/sdb.bg.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/spinner.gif
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/spinner.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/th.bg.gif
===================================================================
(Binary files differ)


Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/th.bg.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/index.html
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/index.html	                        (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/index.html	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1 @@
+<html><head><meta http-equiv="Refresh" content="0; URL=home.seam"/></head></html>

Added: examples/trunk/booking/seam-booking-war/src/main/webapp/main.xhtml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/main.xhtml	                        (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/main.xhtml	2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,157 @@
+<!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:f="http://java.sun.com/jsf/core"
+   xmlns:h="http://java.sun.com/jsf/html"
+   xmlns:s="http://jboss.com/products/seam/taglib"
+   template="/WEB-INF/layout/template.xhtml">
+
+   <ui:define name="content">
+
+      <div class="section">
+  
+         <span class="errors">
+            <h:messages id="messages" globalOnly="true"/>
+         </span>
+    
+         <h1>Search Hotels</h1>
+
+         <h:form id="searchForm">
+            <fieldset> 
+               <h:inputText id="searchString" value="#{searchCriteria.searchString}" style="width: 165px;">
+                  <f:ajax event="keyup" listener="#{hotelSearch.find}" render="searchResults"/>
+               </h:inputText>
+               #{' '}
+               <h:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}">
+                  <ui:remove><f:ajax listener="#{hotelSearch.find}" render="searchResults"/></ui:remove>
+               </h:commandButton>
+               <ui:remove>
+               <!--
+               <a:status id="status">
+                  <f:facet id="startStatus" name="start">
+                     <h:graphicImage id="SpinnerGif" value="/img/spinner.gif"/>
+                  </f:facet>
+               </a:status>
+               -->
+               </ui:remove>
+               <br/>
+               <h:outputLabel id="lblPageSize" for="pageSize" value="Maximum results:"/>
+               #{' '}
+               <h:selectOneMenu id="pageSize" value="#{searchCriteria.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>
+
+      <h:panelGroup id="searchResults">
+         <div class="section">
+            <h:outputText id="noHotelsMsg" value="No Hotels Found" rendered="#{empty hotels}"/>
+            <h:dataTable id="hotels" value="#{hotels}" var="_hotel" rendered="#{not empty hotels}">
+               <h:column id="nameCol">
+                  <f:facet id="nameFct" name="header">Name</f:facet>
+                  #{_hotel.name}
+               </h:column>
+               <h:column id="addressCol">
+                  <f:facet id="addressFct" name="header">Address</f:facet>
+                  #{_hotel.address}
+               </h:column>
+               <h:column id="locationCol">
+                  <f:facet id="locationFct" name="header">Location</f:facet>
+                  #{_hotel.city}, #{_hotel.state}, #{_hotel.country}
+               </h:column> 
+               <h:column id="zipCol">
+                  <f:facet id="zipFct" name="header">Zip</f:facet>
+                  #{_hotel.zip}
+               </h:column>
+               <h:column id="actionCol">
+                  <f:facet id="actionFct" name="header">Action</f:facet>
+                  <ui:remove><!--<s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>--></ui:remove>
+               </h:column>
+            </h:dataTable>
+            <h:form id="paginationForm">
+               <h:commandButton id="previousResults" value="Previous page" action="#{hotelSearch.previousPage}" rendered="#{hotelSearch.previousPageAvailable}"/>
+               #{' '}
+               <h:commandButton id="moreResults" value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}"/>
+               <ui:remove>
+               <!-- links in Mojarra are broken -->
+               <h:commandLink id="previousResults" value="More results" action="#{hotelSearch.previousPage}" rendered="#{hotelSearch.previousPageAvailable}">
+                  <f:ajax listener="#{hotelSearch.previousPage}" render="searchResults"/>
+               </h:commandLink>
+               <h:commandLink id="moreResults" value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}">
+                  <f:ajax listener="#{hotelSearch.nextPage}" render="searchResults"/>
+               </h:commandLink>
+               </ui:remove>
+            </h:form>
+         </div>
+       </h:panelGroup>
+
+<ui:remove>
+<div class="section">
+   <h1>Current Hotel Bookings</h1>
+</div>
+<div class="section">
+  <h:form id="bookings">
+   <h:outputText id="NoBookingsFoundMessage" value="No Bookings Found" rendered="#{bookings.rowCount==0}"/>
+   <h:dataTable id="bookings" value="#{bookings}" var="book" rendered="#{bookings.rowCount>0}">
+      <h:column id="column1">
+         <f:facet id="NameFacet" name="header">Name</f:facet>
+         #{book.hotel.name}
+      </h:column>
+      <h:column id="column2">
+         <f:facet id="AddressFacet" name="header">Address</f:facet>
+         #{book.hotel.address}
+      </h:column>
+      <h:column id="column3">
+         <f:facet id="CityStateFacet" name="header">City, State</f:facet>
+         #{book.hotel.city}, #{book.hotel.state}
+      </h:column>
+        <h:column id="column4">
+            <f:facet id="CheckInDateFacet" name="header">Check in date</f:facet>
+            <h:outputText id="BookingCheckInDate" value="#{book.checkinDate}"/>
+        </h:column>
+        <h:column id="column5">
+            <f:facet id="CheckOutDateFacet" name="header">Check out date</f:facet>
+            <h:outputText id="BookingCheckOutDate" value="#{book.checkoutDate}"/>
+        </h:column>
+      <h:column id="column6">
+         <f:facet id="ConfNumberFacet" name="header">Confirmation number</f:facet>
+         #{book.id}
+      </h:column>
+      <h:column id="column7">
+         <f:facet id="ActionFacet" name="header">Action</f:facet>
+         <h:commandLink id="cancel" value="Cancel" action="#{bookingList.cancel}"/>
+      </h:column>
+   </h:dataTable>
+  </h:form>
+</div>
+</ui:remove>
+
+   </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>




More information about the seam-commits mailing list