Committing plain JSF+Spring sample

This commit is contained in:
Jeremy Grelle
2008-03-27 13:34:14 +00:00
parent 6380f210a0
commit 494c0ae237
63 changed files with 3209 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
Manifest-Version: 1.0

View File

@@ -0,0 +1,11 @@
log4j.rootCategory=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
# Enable web flow logging
log4j.category.org.springframework.webflow=DEBUG
log4j.category.org.springframework.faces=DEBUG
log4j.category.org.springframework.binding=DEBUG
log4j.category.org.springframework.transaction=DEBUG

View File

@@ -0,0 +1,108 @@
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
<managed-bean>
<managed-bean-name>bookingController</managed-bean-name>
<managed-bean-class>org.springframework.webflow.samples.booking.BookingController</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>searchController</managed-bean-name>
<managed-bean-class>org.springframework.webflow.samples.booking.SearchController</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>bookingService</property-name>
<value>#{bookingService}</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>hotelController</managed-bean-name>
<managed-bean-class>org.springframework.webflow.samples.booking.HotelController</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>bookingService</property-name>
<value>#{bookingService}</value>
</managed-property>
<managed-property>
<property-name>hotelId</property-name>
<value>#{param.id}</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>bookingController</managed-bean-name>
<managed-bean-class>org.springframework.webflow.samples.booking.BookingController</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>bookingService</property-name>
<value>#{bookingService}</value>
</managed-property>
<managed-property>
<property-name>hotelId</property-name>
<value>#{hotelController.hotelId}</value>
</managed-property>
<managed-property>
<property-name>booking</property-name>
<value>#{booking}</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>searchCriteria</managed-bean-name>
<managed-bean-class>org.springframework.webflow.samples.booking.SearchCriteria</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<navigation-case>
<from-outcome>changeSearch</from-outcome>
<to-view-id>/main/enterSearchCriteria.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>reviewHotels</from-outcome>
<to-view-id>/main/reviewHotels.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>select</from-outcome>
<to-view-id>/main/reviewHotel.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>book</from-outcome>
<to-view-id>/booking/enterBookingDetails.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>revise</from-outcome>
<to-view-id>/booking/enterBookingDetails.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>cancel</from-outcome>
<to-view-id>/main/enterSearchCriteria.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>confirm</from-outcome>
<to-view-id>/main/enterSearchCriteria.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>reviewBooking</from-outcome>
<to-view-id>/booking/reviewBooking.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<application>
<variable-resolver>org.springframework.web.jsf.SpringBeanVariableResolver</variable-resolver>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
<lifecycle>
<phase-listener>org.springframework.faces.support.RequestLoggingPhaseListener</phase-listener>
</lifecycle>
</faces-config>

View File

@@ -0,0 +1,57 @@
<!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:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:sf="http://www.springframework.org/tags/faces">
<f:view contentType="text/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Spring Faces: Hotel Booking Sample Application</title>
<link type="text/css" rel="stylesheet" href="${request.contextPath}/css-framework/css/tools.css" />
<link type="text/css" rel="stylesheet" href="${request.contextPath}/css-framework/css/typo.css" />
<link type="text/css" rel="stylesheet" href="${request.contextPath}/css-framework/css/forms.css" />
<link type="text/css" rel="stylesheet" href="${request.contextPath}/css-framework/css/layout-navtop-localleft.css" />
<link type="text/css" rel="stylesheet" href="${request.contextPath}/css-framework/css/layout.css" />
<link type="text/css" rel="stylesheet" href="${request.contextPath}/styles/booking.css" />
<ui:insert name="headIncludes"/>
</head>
<body class="tundra spring">
<div id="page">
<div id="header" class="clearfix spring">
<div id="welcome">
<div class="left">Spring Travel: A Spring and JSF Reference Application</div>
<div class="right">
<c:if test="${currentUser.name != 'roleAnonymous'}">
Welcome, JSF Lover
</c:if>
</div>
</div>
<div id="branding" class="spring">
<a href="#{request.contextPath}"><img src="${request.contextPath}/images/header.jpg" alt="Spring Travel"/></a>
</div>
</div>
<div id="content" class="clearfix spring">
<div id="local" class="spring">
<a href="http://www.thespringexperience.com">
<img src="${request.contextPath}/images/diplomat.jpg" />
</a>
<a href="http://www.thespringexperience.com">
<img src="${request.contextPath}/images/tse.gif" />
</a>
<p>
</p>
</div>
<div id="main">
<ui:insert name="content"/>
</div>
</div>
<div id="footer" class="clearfix spring">
<a href="http://www.springframework.org"><img src="${request.contextPath}/images/powered-by-spring.png" /></a>
</div>
</div>
</body>
</f:view>
</html>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!-- Activates annotation-based bean configuration -->
<context:annotation-config />
<!-- Scans for application @Components to deploy -->
<context:component-scan base-package="org.springframework.webflow.samples.booking" />
<!-- Instructs Spring to perfrom declarative transaction managemenet on annotated classes -->
<tx:annotation-driven />
<!-- Drives transactions using local JPA APIs -->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<!-- Creates a EntityManagerFactory for use with the Hibernate JPA provider and a simple in-memory data source populated with test data -->
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
</property>
</bean>
<!-- Deploys a in-memory "booking" datasource populated -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<property name="url" value="jdbc:hsqldb:mem:booking" />
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
</beans>

View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/web-application-config.xml
</param-value>
</context-param>
<!-- Use JSF view templates saved as *.xhtml, for use with Facelets -->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<!-- Enables special Facelets debug output during development -->
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<!-- Causes Facelets to refresh templates during development -->
<context-param>
<param-name>facelets.REFRESH_PERIOD</param-name>
<param-value>1</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Just here so the JSF implementation can initialize, *not* used at runtime -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Just here so the JSF implementation can initialize -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>

View File

@@ -0,0 +1,130 @@
<!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:sf="http://www.springframework.org/tags/faces"
template="/WEB-INF/layouts/standard.xhtml">
<ui:define name="content">
<div class="section">
<h2>Book Hotel</h2>
<h:form id="booking">
<h:messages errorClass="errors" />
<fieldset>
<div class="field">
<div class="label">Name:</div>
<div class="output">#{bookingController.booking.hotel.name}</div>
</div>
<div class="field">
<div class="label">Address:</div>
<div class="output">#{bookingController.booking.hotel.address}</div>
</div>
<div class="field">
<div class="label">City, State:</div>
<div class="output">#{bookingController.booking.hotel.city}, #{bookingController.booking.hotel.state}</div>
</div>
<div class="field">
<div class="label">Zip:</div>
<div class="output">#{bookingController.booking.hotel.zip}</div>
</div>
<div class="field">
<div class="label">Country:</div>
<div class="output">#{bookingController.booking.hotel.country}</div>
</div>
<div class="field">
<div class="label">Nightly rate:</div>
<div class="output">
<h:outputText value="#{bookingController.booking.hotel.price}">
<f:convertNumber type="currency" currencySymbol="$"/>
</h:outputText>
</div>
</div>
<div class="field">
<div class="label">
<h:outputLabel for="checkinDate">Check In Date:</h:outputLabel>
</div>
<div class="input">
<sf:clientDateValidator required="true" >
<h:inputText id="checkinDate" value="#{bookingController.booking.checkinDate}" required="true">
<f:convertDateTime pattern="yyyy-MM-dd" timeZone="EST"/>
</h:inputText>
</sf:clientDateValidator>
</div>
</div>
<div class="field">
<div class="label">
<h:outputLabel for="checkoutDate">Check Out Date:</h:outputLabel>
</div>
<div class="input">
<sf:clientDateValidator required="true">
<h:inputText id="checkoutDate" value="#{bookingController.booking.checkoutDate}" required="true">
<f:convertDateTime pattern="yyyy-MM-dd" timeZone="EST"/>
</h:inputText>
</sf:clientDateValidator>
</div>
</div>
<div class="field">
<div class="label">
<h:outputLabel for="beds">Room Preference:</h:outputLabel>
</div>
<div class="input">
<h:selectOneMenu id="beds" value="#{bookingController.booking.beds}">
<f:selectItems value="#{referenceData.bedOptions}"/>
</h:selectOneMenu>
</div>
</div>
<div class="field">
<div class="label">
<h:outputLabel for="smoking">Smoking Preference:</h:outputLabel>
</div>
<div id="radio" class="input">
<h:selectOneRadio id="smoking" value="#{bookingController.booking.smoking}" layout="pageDirection">
<f:selectItems value="#{referenceData.smokingOptions}"/>
</h:selectOneRadio>
</div>
</div>
<div class="field">
<div class="label">
<h:outputLabel for="creditCard">Credit Card #:</h:outputLabel>
</div>
<div class="input">
<sf:clientTextValidator required="true" regExp="[0-9]{16}" invalidMessage="A 16-digit credit card number is required.">
<h:inputText id="creditCard" value="#{bookingController.booking.creditCard}" required="true"/>
</sf:clientTextValidator>
</div>
</div>
<div class="field">
<div class="label">
<h:outputLabel for="creditCardName">Credit Card Name:</h:outputLabel>
</div>
<div class="input">
<sf:clientTextValidator required="true">
<h:inputText id="creditCardName" value="#{bookingController.booking.creditCardName}" required="true"/>
</sf:clientTextValidator>
</div>
</div>
<div class="field">
<div class="label">
<h:outputLabel for="creditCardExpiryMonth">Expiration Date:</h:outputLabel>
</div>
<div class="input">
<h:selectOneMenu id="creditCardExpiryMonth" value="#{bookingController.booking.creditCardExpiryMonth}">
<f:selectItems value="#{referenceData.creditCardExpMonths}" />
</h:selectOneMenu>
<h:selectOneMenu id="creditCardExpiryYear" value="#{bookingController.booking.creditCardExpiryYear}">
<f:selectItems value="#{referenceData.creditCardExpYears}"/>
</h:selectOneMenu>
</div>
</div>
<div class="buttonGroup">
<h:commandButton id="proceed" action="#{bookingController.processBooking}" value="Proceed"/>&#160;
<h:commandButton id="cancel" immediate="true" value="Cancel" action="#{bookingController.cancel}"/>
</div>
</fieldset>
</h:form>
</div>
</ui:define>
</ui:composition>

View File

@@ -0,0 +1,76 @@
<!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:sf="http://www.springframework.org/tags/faces"
template="/WEB-INF/layouts/standard.xhtml">
<ui:define name="content">
<div class="section">
<h1>Confirm Hotel Booking</h1>
</div>
<div class="section">
<h:form id="confirm">
<fieldset>
<div class="field">
<div class="label">Name:</div>
<div class="output">#{booking.hotel.name}</div>
</div>
<div class="field">
<div class="label">Address:</div>
<div class="output">#{booking.hotel.address}</div>
</div>
<div class="field">
<div class="label">City, State:</div>
<div class="output">#{booking.hotel.city}, #{booking.hotel.state}</div>
</div>
<div class="field">
<div class="label">Zip:</div>
<div class="output">#{booking.hotel.zip}</div>
</div>
<div class="field">
<div class="label">Country:</div>
<div class="output">#{booking.hotel.country}</div>
</div>
<div class="field">
<div class="label">Total payment:</div>
<div class="output">
<h:outputText value="#{booking.total}">
<f:convertNumber type="currency" currencySymbol="$"/>
</h:outputText>
</div>
</div>
<div class="field">
<div class="label">Check In Date:</div>
<div class="output">
<h:outputText value="#{booking.checkinDate}">
<f:convertDateTime dateStyle="short"/>
</h:outputText>
</div>
</div>
<div class="field">
<div class="label">Check Out Date:</div>
<div class="output">
<h:outputText value="#{booking.checkoutDate}">
<f:convertDateTime dateStyle="short"/>
</h:outputText>
</div>
</div>
<div class="field">
<div class="label">Credit Card #:</div>
<div class="output">#{booking.creditCard}</div>
</div>
<div class="buttonGroup">
<h:commandButton id="confirm" value="Confirm" action="#{bookingController.confirm}"/>&#160;
<h:commandButton id="revise" value="Revise" action="revise"/>&#160;
<h:commandButton id="cancel" value="Cancel" action="#{bookingController.cancel}"/>
</div>
</fieldset>
</h:form>
</div>
</ui:define>
</ui:composition>

View File

@@ -0,0 +1,100 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
/* FORM ELEMENTS */
form {
margin:0;
padding:0;
}
form div,
form p {
font-size: 1em;
margin: 0 0 1em 0;
padding: 0;
}
label {
font-weight: bold;
}
fieldset {
border: 1px solid #eee;
padding: 5px 10px;
margin: 0 0 1.5em 0;
}
fieldset legend {
color: #666;
font-size: 1.1em;
font-weight: bold;
margin: 0 0 0 0px;
padding: 0;
background-color: white;
}
* html fieldset legend {
margin: 0 0 10px -10px;
}
fieldset ul {
list-style: none;
margin: 0 0 1.5em 0;
padding: 0;
}
fieldset ul li {
list-style: none;
margin: 0 0 0.5em 0;
padding: 0;
}
input, select, textarea {
font-size:1em;
font-family: arial, helvetica, verdana, sans-serif;
margin: 0;
padding: 2px;
}
input, select {
vertical-align:middle;
}
textarea {
width: 200px;
height: 8em;
}
input.check {
border: none;
width: auto;
height: auto;
margin: 0;
}
input.radio {
border: none;
width: auto;
height: auto;
margin: 0;
}
input.file {
height: auto;
width: 250px;
}
input.readonly {
background-color: transparent;
border: none;
}
input.button {
width: 10em;
border:1px solid black;
background-color: #ddd;
}
input.image {
border: none;
width: auto;
height: auto;
}
form div.submit {
margin: 1em 0;
}
form div.submit input {
height: 2em;
width: 15em;
}
/* END FORM ELEMENTS */

View File

@@ -0,0 +1,27 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
@import url("nav-horizontal.css");
/* NAV BAR AT THE TOP AND ONE COLUMN OF CONTENT */
div#content {
position: relative;
width: 701px;
margin: 0 auto 20px auto;
padding: 0;
text-align: left;
}
div#main {
width: 100%;
}
div#local {
display: none;
}
div#sub {
display: none;
}
div#nav {
display: none;
}
/* END CONTENT */

View File

@@ -0,0 +1,31 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
@import url("nav-vertical.css");
/* NAV BAR ON THE LEFT AND ONE COLUMN OF CONTENT */
div#content {
position: relative;
width: 780px;
margin: 0 auto 20px auto;
padding: 0;
text-align: left;
}
div#main {
float: right;
width: 560px;
display: inline;
}
div#local {
display: none;
}
div#sub {
display: none;
}
div#nav {
float: left;
width: 200px;
display: inline;
}
/* END CONTENT */

View File

@@ -0,0 +1,39 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
@import url("nav-vertical.css");
/* NAV BAR ON THE LEFT AND TWO COLUMNS OF CONTENT */
div#content {
position: relative;
width: 780px;
margin: 0 auto 20px auto;
padding: 0;
text-align: left;
}
div#main {
float: right;
width: 340px;
display: inline;
margin-right: 220px;
margin-left: -220px;
}
div#local {
display: none;
}
div#sub {
float: right;
width: 200px;
display: inline;
margin-right: -340px;
margin-left: 200px;
}
div#nav {
float: left;
width: 200px;
display: inline;
}
/* END CONTENT */

View File

@@ -0,0 +1,32 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
@import url("nav-horizontal.css");
/* NAV BAR AT THE TOP AND ONE COLUMN OF CONTENT */
div#content {
position: relative;
width: 701px;
margin: 0 auto 20px auto;
padding: 0;
text-align: left;
}
div#main {
width: 100%;
}
div#local {
width: 100%;
}
div#sub {
width: 100%;
}
div#nav {
position: absolute;
top: -15px;
left: 0;
width: 100%;
text-align: left;
}
/* END CONTENT */

View File

@@ -0,0 +1,43 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
@import url("nav-horizontal.css");
/* NAV BAR AT THE TOP, LOCAL NAV ON THE LEFT AND TWO COLUMNS OF CONTENT */
div#content {
position: relative;
width: 701px;
margin: 0 auto 20px auto;
padding: 0;
text-align: left;
}
div#main {
float: left;
width: 300px;
display: inline;
margin-right: -200px;
margin-left: 200px;
}
div#sub {
float: right;
width: 180px;
display: inline;
}
div#local {
float: left;
width: 180px;
display: inline;
margin-left: -300px;
}
div#nav {
position: absolute;
top: -15px;
left: 0;
width: 701px;
text-align: left;
}
/* END CONTENT */

View File

@@ -0,0 +1,36 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
@import url("nav-horizontal.css");
/* NAV BAR AT THE TOP, LOCAL NAVIGATION ON THE LEFT AND ONE COLUMN OF CONTENT */
div#content {
position: relative;
width: 701px;
margin: 0 auto 20px auto;
padding: 0;
text-align: left;
}
div#main {
float: right;
width: 500px;
display: inline;
}
div#local {
float: left;
width: 200px;
display: inline;
}
div#sub {
display: none;
}
div#nav {
position: absolute;
top: -15px;
left: 0;
width: 100%;
text-align: left;
}
/* END CONTENT */

View File

@@ -0,0 +1,36 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
@import url("nav-horizontal.css");
/* NAV BAR AT THE TOP AND TWO COLUMNS OF CONTENT */
div#content {
position: relative;
width: 701px;
margin: 0 auto 20px auto;
padding: 0;
text-align: left;
}
div#main {
float: left;
width: 480px;
display: inline;
}
div#sub {
float: right;
width: 200px;
display: inline;
}
div#local {
display: none;
}
div#nav {
position: absolute;
top: -15px;
left: 0;
width: 100%;
text-align: left;
}
/* END CONTENT */

View File

@@ -0,0 +1,125 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
/* SITE SPECIFIC LAYOUT */
body {
margin: 0;
padding: 0;
background: white;
text-align: center;
}
div#page {
width: 780px;
margin: 0 auto;
padding: 0;
background: white;
text-align: center;
}
/* HEADER */
div#header {
margin: 0 0 5em 0;
padding: 40px 20px;
color: white;
background: black;
text-align: left;
}
div#branding {
float: left;
width: 40%;
margin: 0;
padding: 10px 0 10px 20px;
text-align: left;
}
div#search {
float: right;
width: 49%;
margin: 0;
padding: 16px 20px 0 0;
text-align: right;
}
/* END HEADER */
/* CONTENT */
div#content {
}
/* MAIN */
div#main {
}
/* END MAIN */
/* SUB */
div#sub {
}
/* END SUB */
/* END CONTENT */
/* FOOTER */
div#footer {
color: white;
background-color: black;
}
div#footer p {
font-size: 0.8em;
margin: 0;
padding: 15px;
}
/* END FOOTER */
/* END LAYOUT */
/* UL.SUBNAV */
ul.subnav {
margin: 0;
padding: 0;
font-size: 0.8em;
list-style: none;
}
ul.subnav li {
margin: 0 0 1em 0;
padding: 0;
list-style: none;
}
ul.subnav li a,
ul.subnav li a:link,
ul.subnav li a:visited,
ul.subnav li a:active {
text-decoration: none;
font-weight: bold;
color: black;
}
ul.subnav li a:hover {
text-decoration: underline;
}
ul.subnav li strong {
padding: 0 0 0 12px;
background: url("../i/subnav-highlight.gif") left top no-repeat transparent;
}
ul.subnav li strong a,
ul.subnav li strong a:link,
ul.subnav li strong a:visited,
ul.subnav li strong a:active {
color: white;
background-color: black;
}
/* END UL.SUBNAV */

View File

@@ -0,0 +1,80 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
/* NAV */
div#nav {
font-size: 0.8em;
}
* html div#nav {
/* hide ie/mac \*/
height: 1%;
/* end hide */
}
div#nav div.wrapper {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
}
div#nav ul {
width: auto;
width: 100%;
margin: 0;
padding: 0;
line-height: 1em;
list-style: none;
}
div#nav li {
float: left;
display: inline;
list-style: none;
margin: 0;
padding: 0;
line-height: 1em;
border-right: 1px solid #aaa;
}
div#nav li.last {
border-right: none;
}
div#nav a,
div#nav a:link,
div#nav a:active,
div#nav a:visited {
display: inline-block;
/* hide from ie/mac \*/
display: block;
/* end hide */
font-weight: bold;
text-decoration: none;
margin: 0;
padding: 5px 38px 5px 38px;
color: black;
background: #ddd;
}
div#nav a:hover {
text-decoration: underline;
}
div#nav strong {
display: inline-block;
/* hide from ie/mac \*/
display: block;
/* end hide */
color: white;
background: black;
}
div#nav strong a,
div#nav strong a:link,
div#nav strong a:active,
div#nav strong a:visited,
div#nav strong a:hover {
color: white;
background-color: black;
}
/* END NAV */

View File

@@ -0,0 +1,79 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
/* NAV */
div#nav {
font-size: 0.8em;
}
* html div#nav {
/* hide ie/mac \*/
height: 1%;
/* end hide */
}
div#nav div.wrapper {
width: 100%;
background: #ddd;
}
div#nav ul {
width: auto;
width: 100%;
margin: 0;
padding: 0;
line-height: 1em;
list-style: none;
}
div#nav li {
display: block;
list-style: none;
margin: 0;
padding: 0;
line-height: 1em;
}
* html div#nav li {
/* hide ie/mac \*/
height: 1%;
/* end hide */
}
div#nav li.last {
}
div#nav a,
div#nav a:link,
div#nav a:active,
div#nav a:visited {
display: block;
font-weight: bold;
text-decoration: none;
margin: 0;
padding: 5px 10px 5px 10px;
color: black;
background: white;
}
div#nav a:hover {
color: white;
background: black;
text-decoration: underline;
}
div#nav strong {
display: block;
color: white;
background: black;
}
div#nav strong a,
div#nav strong a:link,
div#nav strong a:active,
div#nav strong a:visited,
div#nav strong a:hover {
color: white;
background-color: black;
}
/* END NAV */

View File

@@ -0,0 +1,68 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
/* clearing */
.stretch,
.clear {
clear:both;
height:1px;
margin:0;
padding:0;
font-size: 15px;
line-height: 1px;
}
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
* html>body .clearfix {
display: inline-block;
width: 100%;
}
* html .clearfix {
/* Hides from IE-mac \*/
height: 1%;
/* End hide from IE-mac */
}
/* end clearing */
/* replace */
.replace {
display:block;
background-repeat: no-repeat;
background-position: left top;
background-color:transparent;
}
/* tidy these up */
.replace * {
text-indent: -10000px;
display:block;
background-repeat: no-repeat;
background-position: left top;
background-color:transparent;
}
.replace a {
text-indent:0;
}
.replace a span {
text-indent:-10000px;
}
/* end replace */
/* accessibility */
span.accesskey {
text-decoration:none;
}
.accessibility {
position: absolute;
top: -999em;
left: -999em;
}
/* end accessibility */

View File

@@ -0,0 +1,177 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
/* TYPOGRAPHY */
body {
text-align: left;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 76%;
line-height: 1em;
color: #333;
}
div {
font-size: 1em;
}
img {
border: 0;
}
/* LINKS */
a,
a:link
a:active {
color: blue;
background-color: white;
text-decoration: underline;
}
a:visited {
color: purple;
background-color: transparent;
}
a:hover {
color: white;
background-color: black;
text-decoration: none;
}
/* END LINKS */
/* HEADINGS */
h1 {
font-size: 2em;
line-height: 1.5em;
margin: 0 0 0.5em 0;
padding: 0;
color: black;
}
h2 {
font-size: 1.5em;
line-height: 1.5em;
margin: 0 0 0.5em 0;
padding: 0;
color: black;
}
h3 {
font-size: 1.3em;
line-height: 1.3em;
margin: 0 0 0.5em 0;
padding:0;
color: black;
}
h4 {
font-size: 1.2em;
line-height: 1.3em;
margin: 0 0 0.25em 0;
padding: 0;
color: black;
}
h5 {
font-size: 1.1em;
line-height: 1.3em;
margin: 0 0 0.25em 0;
padding: 0;
color: black;
}
h6 {
font-size: 1em;
line-height: 1.3em;
margin: 0 0 0.25em 0;
padding: 0;
color: black;
}
/* END HEADINGS */
/* TEXT */
p {
font-size: 1em;
margin: 0 0 1.5em 0;
padding: 0;
line-height:1.4em;
}
blockquote {
border-left:10px solid #ddd;
margin-left:10px;
}
pre {
font-family: monospace;
font-size: 1.0em;
}
strong, b {
font-weight: bold;
}
em, i {
font-style:italic;
}
code {
font-family: "Courier New", Courier, monospace;
font-size: 1em;
white-space: pre;
}
/* END TEXT */
/* LISTS */
ul {
line-height:1.4em;
margin: 0 0 1.5em 0;
padding: 0;
}
ul li {
margin: 0 0 0.25em 30px;
padding: 0;
}
ol {
font-size: 1.0em;
line-height: 1.4em;
margin: 0 0 1.5em 0;
padding: 0;
}
ol li {
font-size: 1.0em;
margin: 0 0 0.25em 30px;
padding: 0;
}
dl {
margin: 0 0 1.5em 0;
padding: 0;
line-height: 1.4em;
}
dl dt {
font-weight: bold;
margin: 0.25em 0 0.25em 0;
padding: 0;
}
dl dd {
margin: 0 0 0 30px;
padding: 0;
}
/* END LISTS */
/* TABLE */
table {
font-size: 1em;
margin: 0 0 1.5em 0;
padding: 0;
}
table caption {
font-weight: bold;
margin: 0 0 0 0;
padding: 0 0 1.5em 0;
}
th {
font-weight: bold;
text-align: left;
}
td {
font-size: 1em;
}
/* END TABLE */
hr {
display: none;
}
div.hr {
height: 1px;
margin: 1.5em 10px;
border-bottom: 1px dotted black;
}
/* END TYPOGRAPHY */

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,5 @@
<html>
<head>
<meta http-equiv="Refresh" content="0; URL=intro.faces">
</head>
</html>

View File

@@ -0,0 +1,38 @@
<!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:sf="http://www.springframework.org/tags/faces"
template="/WEB-INF/layouts/standard.xhtml">
<ui:define name="content">
<div class="section">
<h1>Welcome to Spring Travel</h1>
<p>
This reference application illustrates <a href="http://www.springframework.org/faces">Spring Faces</a>,
a software library that integrates Spring and JavaServerFaces technology to power rich web applications.
</p>
<p>
The key features illustrated in this sample include:
</p>
<ul>
<li>A declarative navigation model enabling full browser button support and dynamic navigation rules</li>
<li>A fine-grained state management model, including support for ConversationScope and ViewScope</li>
<li>Modularization of web application functionality by domain use case, illustrating project structure best-practices</li>
<li>Managed persistence contexts with the Java Persistence API (JPA)</li>
<li>Unified Expression Language (EL) integration</li>
<li>Spring Security integration</li>
<li>Declarative page authoring with Facelets, including applying reusable page layouts</li>
<li>A lightweight component library for Ajax and client-side validation that employs progressive enhancement techniques</li>
<li>Exception handling support across all layers of the application</li>
<li>Spring IDE tooling integration, with support for graphical flow modeling and visualization</li>
</ul>
<p align="right">
<a href="main/enterSearchCriteria.faces">Start your Spring Travel experience</a>
</p>
</div>
</ui:define>
</ui:composition>

View File

@@ -0,0 +1,77 @@
<!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"
template="/WEB-INF/layouts/standard.xhtml">
<ui:define name="content">
<div id="hotelSearch" class="section">
<span class="errors">
<h:messages globalOnly="true" />
</span>
<h2>Search Hotels</h2>
<h:form id="mainForm">
<fieldset>
<div class="searchGroup">
<div class="searchField">
<h:inputText id="searchString" value="#{searchController.searchCriteria.searchString}" style="width: 165px; height: 15px;" />
</div>
<div class="searchSize">
<h:outputLabel for="pageSize">Maximum results:</h:outputLabel>
<h:selectOneMenu id="pageSize" value="#{searchController.searchCriteria.pageSize}">
<f:selectItems value="#{referenceData.pageSizeOptions}" />
</h:selectOneMenu>
</div>
<div class="searchButton">
<h:commandButton id="findHotels" value="Find Hotels" action="#{searchController.search}"/>
</div>
</div>
</fieldset>
</h:form>
</div>
<div id="bookingsSection" class="section">
<h:form id="bookingsForm">
<h2>Current Hotel Bookings</h2>
<h:outputText value="No Bookings Found" rendered="#{searchController.bookings.rowCount == 0}"/>
<h:dataTable id="bookings" styleClass="summary" value="#{searchController.bookings}" var="booking" rendered="#{empty searchController.bookings or searchController.bookings.rowCount > 0}">
<h:column>
<f:facet name="header">Name</f:facet>
#{booking.hotel.name}
</h:column>
<h:column>
<f:facet name="header">Address</f:facet>
#{booking.hotel.address}
</h:column>
<h:column>
<f:facet name="header">City, State</f:facet>
#{booking.hotel.city}, #{booking.hotel.state}
</h:column>
<h:column>
<f:facet name="header">Check in date</f:facet>
<h:outputText value="#{booking.checkinDate}">
<f:convertDateTime dateStyle="short"/>
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">Check out date</f:facet>
<h:outputText value="#{booking.checkoutDate}">
<f:convertDateTime dateStyle="short"/>
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">Confirmation number</f:facet>
#{booking.id}
</h:column>
<h:column>
<f:facet name="header">Action</f:facet>
<h:commandLink id="cancel" value="Cancel" actionListener="#{searchController.cancelBookingListener}" />
</h:column>
</h:dataTable>
</h:form>
</div>
</ui:define>
</ui:composition>

View File

@@ -0,0 +1,58 @@
<!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:sf="http://www.springframework.org/tags/faces"
template="/WEB-INF/layouts/standard.xhtml">
<ui:define name="content">
<div class="section">
<h2>View Hotel</h2>
<div class="field">
<div class="label">Name:</div>
<div class="output">#{hotelController.hotel.name}</div>
</div>
<div class="field">
<div class="label">Address:</div>
<div class="output">#{hotelController.hotel.address}</div>
</div>
<div class="field">
<div class="label">City:</div>
<div class="output">#{hotelController.hotel.city}</div>
</div>
<div class="field">
<div class="label">State:</div>
<div class="output">#{hotelController.hotel.state}</div>
</div>
<div class="field">
<div class="label">Zip:</div>
<div class="output">#{hotelController.hotel.zip}</div>
</div>
<div class="field">
<div class="label">Country:</div>
<div class="output">#{hotelController.hotel.country}</div>
</div>
<div class="field">
<div class="label">Nightly rate:</div>
<div class="output">
<h:outputText value="#{hotelController.hotel.price}">
<f:convertNumber type="currency" currencySymbol="$"/>
</h:outputText>
</div>
</div>
</div>
<div class="section">
<h:form id="hotel">
<fieldset class="buttonGroup">
<h:commandButton id="book" ajaxEnabled="false" action="book" value="Book Hotel"/>&#160;
<h:commandButton id="cancel" ajaxEnabled="false" action="cancel" value="Back to Search"/>
</fieldset>
<h:inputText id="hotelId" value="#{hotelController.hotelId}" style="visibility:hidden"/>
</h:form>
</div>
</ui:define>
</ui:composition>

View File

@@ -0,0 +1,57 @@
<!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"
template="/WEB-INF/layouts/standard.xhtml">
<ui:define name="content">
<h:form id="hotels">
<div class="section">
<h2>Hotel Results</h2>
<p>
<h:commandLink value="Change Search" action="changeSearch"/>
</p>
<div id="searchResults">
<h:outputText id="noHotelsText" value="No Hotels Found" rendered="#{searchController.hotels.rowCount == 0}"/>
<h:dataTable id="hotels" styleClass="summary" value="#{searchController.hotels}" var="hotel" rendered="#{searchController.hotels.rowCount > 0}">
<h:column>
<f:facet name="header">Name</f:facet>
#{hotel.name}
</h:column>
<h:column>
<f:facet name="header">Address</f:facet>
#{hotel.address}
</h:column>
<h:column>
<f:facet name="header">City, State</f:facet>
#{hotel.city}, #{hotel.state}, #{hotel.country}
</h:column>
<h:column>
<f:facet name="header">Zip</f:facet>
#{hotel.zip}
</h:column>
<h:column>
<f:facet name="header">Action</f:facet>
<a href="reviewHotel.faces?id=#{hotel.id}">View Hotel</a>
</h:column>
</h:dataTable>
<div class="next">
<h:commandLink id="nextPageLink" value="More Results" actionListener="#{searchController.nextListener}" rendered="#{empty searchController.hotels or searchController.hotels.rowCount == searchController.searchCriteria.pageSize}"/>
</div>
<div class="previous">
<h:commandLink id="previousPageLink" value="Previous results" actionListener="#{searchController.prevListener}" rendered="#{empty searchController.hotels or searchController.searchCriteria.page > 0}"/>
</div>
</div>
<div style="visibility:hidden">
<h:inputText id="searchString" value="#{searchController.searchCriteria.searchString}"/>
<h:inputText id="pageSize" value="#{searchController.searchCriteria.pageSize}"/>
<h:inputText id="page" value="#{searchController.searchCriteria.page}"/>
</div>
</div>
</h:form>
</ui:define>
</ui:composition>

View File

@@ -0,0 +1,187 @@
a, a:visited, a:link, a:active {
color: #59924B;
background-color: transparent;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: white;
background-color: #65a242;
text-decoration: none;
font-weight: bold;
}
body.spring {
background-color: #9cac7c;
}
#header.spring {
margin: 0 0 1em 0;
padding: 0px 0px;
background-color : #414f23;
}
#branding.spring {
float: none;
width: 100%;
margin: 10px 0 0 0;
padding: 0 0 0 0;
text-align: none;
}
#welcome {
padding: 10px 10px;
}
#welcome div.left {
float: left;
}
#welcome div.right {
float: right;
}
#content.spring form div,
#content.spring form p {
padding: 0px;
margin: 0 0 .5em 0;
}
#content.spring {
width: 740px;
background: #fff url(../images/bg.gif) 0 0 repeat;
margin-bottom: 0px;
}
#content .section {
width: 505px;
float: left;
margin-bottom: 5px;
}
#content.spring input[type="submit"], input[type="button"], button {
font-weight: bold;
color: #fff;
height: 20px;
background: #fff url(../images/btn.bg.gif) 0 0 repeat-x;
border-style: none;
vertical-align: middle;
}
#content.spring button
{
font-size: 1em;
font-family: arial,helvetica,verdana,sans-serif;
margin-top: 0pt;
margin-right: 0pt;
margin-bottom: 0pt;
margin-left: 0pt;
padding-top: 2px;
padding-right: 2px;
padding-bottom: 2px;
padding-left: 2px;
}
#content.spring button
{
vertical-align: middle;
}
.errors {
font-weight: bold;
text-align: left;
color: #600;
}
.errors ul {
list-style: none;
}
#content .field {
float:left;
}
#content .field .label {
float: left;
padding-top: 5px;
padding-right: 5px;
font-weight: bold;
width: 150px;
text-align: right;
}
#content .field .output {
float: left;
width: 250px;
padding-top: 5px;
text-align: left;
}
#content .field .input {
float: left;
width: 250px;
text-align: left;
}
#content .searchGroup {
width: 35%;
}
#content .buttonGroup {
clear: both;
text-align: right;
}
#content .buttonGroup input[type="submit"], .buttonGroup input[type="button"] {
margin-right: 5px;
}
#content .previous {
float: right;
}
#content .next {
float: right;
}
#content .next a {
margin-left: 20px;
}
#content .summary {
width: 100%;
border: 1px solid #414f23;
border-collapse: collapse;
}
#content .summary thead th {
border-left: 1px solid #414f23;
background: #fff url(../images/th.bg.gif) 0 100% repeat-x;
border-bottom: 1px solid #414f23;
padding: 6px;
text-align: left;
font-size: small;
}
#content .summary tbody td {
border-left: 1px solid #9cac7c;
padding: 4px;
border-bottom: 1px solid #9cac7c;
font-size: 8pt;
}
#local.spring{
width: 215px;
}
#footer.spring {
padding: 25px 0;
background-color : white;
border-top: 1px solid #C3BBB6;
}
#footer.spring img {
float: right;
padding-right: 20px;
}