documentation
This commit is contained in:
@@ -8,8 +8,10 @@
|
||||
http://www.springframework.org/schema/tx
|
||||
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
|
||||
|
||||
<!-- The central service of this application that can query hotels and bookings, as well as cancel bookings -->
|
||||
<bean id="bookingService" class="org.springframework.webflow.samples.booking.app.JpaBookingService" />
|
||||
|
||||
<!-- 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">
|
||||
@@ -17,6 +19,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- Deploys a in-memory "booking" datasource -->
|
||||
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
|
||||
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
|
||||
<property name="url" value="jdbc:hsqldb:mem:booking" />
|
||||
@@ -24,13 +27,18 @@
|
||||
<property name="password" value="" />
|
||||
</bean>
|
||||
|
||||
<!-- Executes transactions around @Transactional methods -->
|
||||
<tx:annotation-driven transaction-manager="transactionManager"/>
|
||||
|
||||
<!-- Drives transactions using local JPA APIs -->
|
||||
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
</bean>
|
||||
|
||||
<!-- Automatically injects EntityManager references into data access objects that require one -->
|
||||
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
|
||||
|
||||
<!-- Maps JPA exceptions that occur to Spring's DataAccessException hierarchy -->
|
||||
<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
|
||||
|
||||
</beans>
|
||||
@@ -8,6 +8,7 @@
|
||||
http://www.springframework.org/schema/webflow-config
|
||||
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd">
|
||||
|
||||
<!-- Imports the "application-layer" definining business logic and data access services -->
|
||||
<import resource="application-layer-config.xml"/>
|
||||
|
||||
<!-- Launches new flow executions and resumes existing executions -->
|
||||
@@ -31,12 +32,14 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- Enables use of the unified expression language (EL) from flow definitions -->
|
||||
<bean id="jsfExpressionParser" class="org.springframework.faces.el.Jsf12ELExpressionParser">
|
||||
<constructor-arg >
|
||||
<bean class="org.jboss.el.ExpressionFactoryImpl"/>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<!-- Installs a listener that manages JPA persistence contexts for flows that require them -->
|
||||
<bean id="jpaConversationListener" class="org.springframework.webflow.persistence.JpaFlowExecutionListener">
|
||||
<constructor-arg>
|
||||
<ref bean="entityManagerFactory"/>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
<faces-config>
|
||||
<application>
|
||||
<!-- Enables Facelets -->
|
||||
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
|
||||
</application>
|
||||
</faces-config>
|
||||
@@ -4,6 +4,7 @@
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
|
||||
version="2.4">
|
||||
|
||||
<!-- The location of the configuration of this Spring Faces application; a path to a Spring configuration file -->
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>
|
||||
@@ -11,27 +12,20 @@
|
||||
</param-value>
|
||||
</context-param>
|
||||
|
||||
<!-- Use Documents Saved as *.xhtml -->
|
||||
<!-- 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>
|
||||
|
||||
<!-- Bootstraps the root Spring Web Application Context, responsible for deploying managed beans
|
||||
defined in the configuration files above. These beans represent the services used by the JSF application. -->
|
||||
<!-- Bootstraps the "root" Spring WebApplicationContext, responsible for deploying the managed beans
|
||||
defined in the web-application-config.xml file above. These beans define the back-end services of the JSF application. -->
|
||||
<listener>
|
||||
<listener-class>
|
||||
org.springframework.web.context.ContextLoaderListener
|
||||
</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- Listener for enabling request and session scoped beans in Spring -->
|
||||
<listener>
|
||||
<listener-class>
|
||||
org.springframework.web.context.request.RequestContextListener
|
||||
</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- Guarantees that under all JSF exit conditions, the flow context will be cleaned up -->
|
||||
<filter>
|
||||
<filter-name>Flow System Cleanup Filter</filter-name>
|
||||
@@ -40,19 +34,20 @@
|
||||
</filter-class>
|
||||
</filter>
|
||||
|
||||
<!-- Filters all request to *.spring to the Flow System Cleanup Filter for guarenteed cleanup -->
|
||||
<!-- Runs all requests to *.spring through the FlowSystemCleanupFilter for guarenteed cleanup -->
|
||||
<filter-mapping>
|
||||
<filter-name>Flow System Cleanup Filter</filter-name>
|
||||
<url-pattern>*.spring</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<!-- The front controller for the JSF application, responsible for handling all application requests -->
|
||||
<!-- The front controller of the JSF application, responsible for handling all application requests -->
|
||||
<servlet>
|
||||
<servlet-name>Faces Servlet</servlet-name>
|
||||
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<!-- Map all *.spring requests to the Faces Servlet for handling -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>Faces Servlet</servlet-name>
|
||||
<url-pattern>*.spring</url-pattern>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?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:flow="http://www.springframework.org/schema/webflow-config"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/webflow
|
||||
http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
|
||||
|
||||
<!--
|
||||
Indicates this flow requires a persistence context
|
||||
One will be created automatically when this flow starts; all data access will use it automatically
|
||||
-->
|
||||
<attribute name="persistenceContext" value="true" />
|
||||
|
||||
<input-mapper>
|
||||
@@ -44,10 +48,12 @@
|
||||
</view-state>
|
||||
|
||||
<end-state id="cancel">
|
||||
<!-- Indicates any changes to managed persistent entities should NOT be committed to the database -->
|
||||
<attribute name="commit" value="false" type="boolean" />
|
||||
</end-state>
|
||||
|
||||
<end-state id="bookingAuthorized">
|
||||
<!-- Indicates changes to managed persistent entities should be committed to the database at this point -->
|
||||
<attribute name="commit" value="true" type="boolean" />
|
||||
</end-state>
|
||||
|
||||
|
||||
@@ -20,27 +20,22 @@
|
||||
<div class="label">Name:</div>
|
||||
<div class="output">#{hotel.name}</div>
|
||||
</div>
|
||||
|
||||
<div class="entry">
|
||||
<div class="label">Address:</div>
|
||||
<div class="output">#{hotel.address}</div>
|
||||
</div>
|
||||
|
||||
<div class="entry">
|
||||
<div class="label">City, State:</div>
|
||||
<div class="output">#{hotel.city}, #{hotel.state}</div>
|
||||
</div>
|
||||
|
||||
<div class="entry">
|
||||
<div class="label">Zip:</div>
|
||||
<div class="output">#{hotel.zip}</div>
|
||||
</div>
|
||||
|
||||
<div class="entry">
|
||||
<div class="label">Country:</div>
|
||||
<div class="output">#{hotel.country}</div>
|
||||
</div>
|
||||
|
||||
<div class="entry">
|
||||
<div class="label">Nightly rate:</div>
|
||||
<div class="output">
|
||||
@@ -49,7 +44,6 @@
|
||||
</h:outputText>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="entry">
|
||||
<div class="label">
|
||||
<h:outputLabel for="checkinDate">Check In Date:</h:outputLabel>
|
||||
@@ -62,7 +56,6 @@
|
||||
</sf:clientDateValidator>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="entry">
|
||||
<div class="label">
|
||||
<h:outputLabel for="checkoutDate">Check Out Date:</h:outputLabel>
|
||||
@@ -75,7 +68,6 @@
|
||||
</sf:clientDateValidator>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="entry">
|
||||
<div class="label">
|
||||
<h:outputLabel for="beds">Room Preference:</h:outputLabel>
|
||||
@@ -88,7 +80,6 @@
|
||||
</h:selectOneMenu>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="entry">
|
||||
<div class="label">
|
||||
<h:outputLabel for="smoking">Smoking Preference:</h:outputLabel>
|
||||
@@ -100,7 +91,6 @@
|
||||
</h:selectOneRadio>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="entry">
|
||||
<div class="label">
|
||||
<h:outputLabel for="creditCard">Credit Card #:</h:outputLabel>
|
||||
@@ -111,7 +101,6 @@
|
||||
</sf:clientNumberValidator>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="entry">
|
||||
<div class="label">
|
||||
<h:outputLabel for="creditCardName">Credit Card Name:</h:outputLabel>
|
||||
@@ -122,7 +111,6 @@
|
||||
</sf:clientTextValidator>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="entry">
|
||||
<div class="label">
|
||||
<h:outputLabel for="creditCardExpiryMonth">Credit Card Expiry:</h:outputLabel>
|
||||
@@ -151,11 +139,9 @@
|
||||
</h:selectOneMenu>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="entry errors">
|
||||
<h:messages globalOnly="true"/>
|
||||
</div>
|
||||
|
||||
<div class="entry">
|
||||
<div class="label"> </div>
|
||||
<div class="input">
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
template="/template.xhtml">
|
||||
|
||||
<!-- content -->
|
||||
<ui:define name="content">
|
||||
|
||||
<div class="section">
|
||||
<h1>Confirm Hotel Booking</h1>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h:form id="confirm">
|
||||
<fieldset>
|
||||
@@ -41,7 +42,7 @@
|
||||
currencySymbol="$"/>
|
||||
</h:outputText>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="entry">
|
||||
<div class="label">Check In Date:</div>
|
||||
<div class="output"><h:outputText value="#{booking.checkinDate}"/></div>
|
||||
@@ -65,6 +66,6 @@
|
||||
</fieldset>
|
||||
</h:form>
|
||||
</div>
|
||||
</ui:define>
|
||||
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?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:flow="http://www.springframework.org/schema/webflow-config"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
|
||||
Reference in New Issue
Block a user