webapp module

This commit is contained in:
Keith Donald
2008-05-27 21:45:56 +00:00
parent 54e70ebbb9
commit 483495ef04
26 changed files with 427 additions and 8 deletions

View File

@@ -1,15 +1,15 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Spring Travel Hotels Module
Bundle-Name: Spring Travel Hotel Module
Bundle-SymbolicName: org.springframework.samples.springtravel.hotel
Bundle-Vendor: SpringSource
Import-Package: javax.sql
Export-Package: org.springframework.samples.springtravel.hotel
Import-Bundle: org.springframework.binding;version="[2.0.1, 3.0)",
org.springframework.faces;version="[2.0.1, 3.0)",
org.springframework.security;version="2.0.0"
org.springframework.security;version="2.0.0",
org.springframework.webflow;version="[2.0.1, 3.0)",
com.springsource.org.apache.log4j;version="1.2.15"
com.springsource.org.apache.log4j;version="1.2.15",
com.springsource.org.jboss.el;version="2.0.0"
Import-Library: org.hibernate.ejb;version="3.3.1",
org.springframework.spring;version="[2.5.4, 3.0)"

View File

@@ -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:context="http://www.springframework.org/schema/context"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:webflow="http://www.springframework.org/schema/webflow-config"
xmlns:faces="http://www.springframework.org/schema/faces"
xsi:schemaLocation="
@@ -9,8 +8,6 @@
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/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd
http://www.springframework.org/schema/faces
@@ -61,8 +58,6 @@
</property>
</bean>
<osgi:reference id="dataSource" interface="javax.sql.DataSource"/>
<!-- Enables annotation based configuration for @Transactional, @Repository, and @PersistenceContext -->
<context:annotation-config/>

View File

@@ -8,6 +8,8 @@
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<reference id="dataSource" interface="javax.sql.DataSource" />
<service ref="hotelHandlerMappings" interface="org.springframework.web.servlet.HandlerMapping" />
</beans:beans>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="src" path="src/main/webapp"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="com.springsource.platform.ide.jdt.core.MANIFEST_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.springframework.samples.springtravel.webapp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.core.springbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.springframework.ide.eclipse.core.springnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,7 @@
#Wed Apr 30 15:14:56 BST 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="jst.java" version="5.0"/>
<installed facet="com.springsource.platform.bundle" version="1.0"/>
</faceted-project>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<beansProjectDescription>
<version>1</version>
<pluginVersion><![CDATA[2.0.5.v200805032123]]></pluginVersion>
<configSuffixes>
<configSuffix><![CDATA[xml]]></configSuffix>
</configSuffixes>
<enableImports><![CDATA[false]]></enableImports>
<configs>
<config>src/main/webapp/META-INF/spring/module-context.xml</config>
<config>src/main/webapp/META-INF/spring/osgi-context.xml</config>
</configs>
<configSets>
</configSets>
</beansProjectDescription>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="org.springframework.samples.springtravel.webapp" xmlns:ivy="antlib:org.apache.ivy.ant">
<property file="${basedir}/../build.properties"/>
<property file="${basedir}/../build.versions"/>
<import file="${basedir}/../spring-build/web-module/default.xml"/>
</project>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?>
<ivy-module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd"
version="1.3">
<info organisation="org.springframework.samples" module="${ant.project.name}">
<ivyauthor name="Keith Donald"/>
<ivyauthor name=""/>
</info>
<configurations>
<include file="${spring.build.dir}/common/default-ivy-configurations.xml"/>
</configurations>
<publications>
<artifact name="${ant.project.name}"/>
<artifact name="${ant.project.name}-sources" type="src" ext="jar"/>
</publications>
<dependencies>
</dependencies>
</ivy-module>

View File

@@ -0,0 +1,15 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.springframework.samples.springtravel.webapp
Bundle-Name: Spring Travel Web Application Module
Platform-ModuleType: Web
Web-ContextPath: springtravel-faces
Web-DispatcherServletUrlPatterns: /spring/*
Web-Servlets: FacesServlet;servlet-class:="javax.faces.webapp.FacesServlet";load-on-startup:="1";url-patterns:="*.faces",
ResourcesServlet;servlet-class:="org.springframework.js.resource.ResourceServlet";load-on-startup:="0";url-patterns:="/resources/*"
Web-FilterMappings: springSecurityFilterChain;url-patterns:="/*"
Web-ContextParams: javax.faces.DEFAULT_SUFFIX;param-value:=".xhtml",
facelets.DEVELOPMENT;param-value:="true",
facelets.REFRESH_PERIOD;param-value:="1"
Web-SessionTimeout: 5
Web-WelcomeFiles: index.html

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!-- Maps request URIs to controllers -->
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="defaultHandler">
<!-- Selects view names to render based on the request URI: e.g. /main selects "main" -->
<bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />
</property>
</bean>
<!-- Maps logical view names to Facelet templates (e.g. 'search' to '/WEB-INF/search.xhtml' -->
<bean id="faceletsViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.faces.mvc.JsfView"/>
<property name="prefix" value="/WEB-INF/" />
<property name="suffix" value=".xhtml" />
</bean>
</beans>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans
xmlns="http://www.springframework.org/schema/osgi"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<reference id="hotelHandlerMappings" interface="org.springframework.web.servlet.HandlerMapping" />
</beans:beans>

View File

@@ -0,0 +1,11 @@
<?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>
<application>
<!-- Enables Facelets -->
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
</faces-config>

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="layouts/standard.xhtml">
<ui:define name="content">
<div class="section">
<h1>Welcome to Spring Travel</h1>
<p>
This reference application illustrates how to use Spring MVC, Spring Web Flow, and Spring Faces
together to power rich web applications based on Spring and JavaServerFaces technology.
</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">Start your Spring Travel experience</a>
</p>
</div>
</ui:define>
</ui:composition>

View File

@@ -0,0 +1,63 @@
<!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>
<sf:includeStyles/>
<sf:resourceGroup>
<sf:resource path="/css-framework/css/tools.css"/>
<sf:resource path="/css-framework/css/typo.css"/>
<sf:resource path="/css-framework/css/forms.css"/>
<sf:resource path="/css-framework/css/layout-navtop-localleft.css"/>
<sf:resource path="/css-framework/css/layout.css"/>
</sf:resourceGroup>
<sf:resource path="/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 Faces Reference Application</div>
<div class="right">
<c:if test="${not empty currentUser.name}">
Welcome, ${currentUser.name} | <a href="${request.contextPath}/spring/logout">Logout</a>
</c:if>
<c:if test="${empty currentUser.name}">
<a href="${request.contextPath}/spring/login">Login</a>
</c:if>
</div>
</div>
<div id="branding" class="spring">
<a href="#{request.contextPath}"><img src="${request.contextPath}/resources/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}/resources/images/diplomat.jpg" alt="generic hotel" />
</a>
<a href="http://www.thespringexperience.com">
<img src="${request.contextPath}/resources/images/tse.gif" alt="The Spring Experience" />
</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}/resources/images/powered-by-spring.png" alt="Powered by Spring" /></a>
</div>
</div>
</body>
</f:view>
</html>

View File

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

View File

@@ -0,0 +1,154 @@
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;
}
form div,
form p {
padding: 0px;
margin: 0 0 .5em 0;
}
#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 {
width: 740px;
background: #fff url(../images/bg.gif) 0 0 repeat;
margin-bottom: 0px;
}
#content.spring input[type="submit"], input[type="button"], button {
font-size: 1em;
font-weight: bold;
color: #fff;
background: #fff url(../images/btn.bg.gif) 0 0 repeat-x;
border-style: none;
padding: 2px 2px 2px 2px;
}
#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;
}
.errors {
font-weight: bold;
text-align: left;
color: #600;
}
.errors ul {
list-style: none;
}
.section {
text-align: left;
width: 505px;
float: left;
margin-bottom: 5px;
}
.field {
float:left;
}
.field .label {
float: left;
padding-top: 5px;
padding-right: 5px;
font-weight: bold;
width: 150px;
text-align: right;
}
.field .input {
float: left;
width: 250px;
text-align: left;
}
.field .output {
float: left;
width: 250px;
padding-top: 5px;
text-align: left;
}
.buttonGroup {
clear: both;
text-align: right;
}
.buttonGroup input[type="submit"], .buttonGroup input[type="button"], .buttonGroup button, .buttonGroup a {
margin-left: 5px;
margin-right: 5px;
}
.summary {
width: 100%;
border: 1px solid #414f23;
border-collapse: collapse;
}
.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;
}
.summary tbody td {
border-left: 1px solid #9cac7c;
padding: 4px;
border-bottom: 1px solid #9cac7c;
font-size: 8pt;
}