SWF-1243 Comprehensive update for JSF 2.0 support
This commit is contained in:
@@ -21,11 +21,10 @@
|
||||
|
||||
<dependencies>
|
||||
<!-- core dependencies -->
|
||||
<dependency org="com.sun.facelets" name="com.springsource.com.sun.facelets" rev="1.1.14" conf="compile->runtime"/>
|
||||
<dependency org="javax.el" name="com.springsource.javax.el" rev="1.0.0" conf="provided->runtime"/>
|
||||
<dependency org="javax.persistence" name="com.springsource.javax.persistence" rev="1.0.0" conf="compile->runtime"/>
|
||||
<dependency org="javax.servlet" name="com.springsource.javax.servlet" rev="2.4.0" conf="provided->runtime"/>
|
||||
<dependency org="javax.servlet" name="com.springsource.javax.servlet.jsp.jstl" rev="1.1.2" conf="compile->runtime"/>
|
||||
<dependency org="javax.servlet" name="com.springsource.javax.servlet.jsp.jstl" rev="1.2.0" conf="compile->runtime"/>
|
||||
<dependency org="javax.transaction" name="com.springsource.javax.transaction" rev="1.1.0" conf="compile->runtime"/>
|
||||
<dependency org="org.apache.log4j" name="com.springsource.org.apache.log4j" rev="1.2.15" conf="compile->runtime"/>
|
||||
<dependency org="org.hibernate" name="com.springsource.org.hibernate" rev="3.2.6.ga" conf="compile->runtime"/>
|
||||
@@ -46,10 +45,23 @@
|
||||
<dependency org="org.springframework.security" name="org.springframework.security.core" rev="3.0.2.RELEASE" conf="compile->runtime"/>
|
||||
<dependency org="org.springframework.security" name="org.springframework.security.config" rev="3.0.2.RELEASE" conf="compile->runtime"/>
|
||||
<dependency org="org.springframework.security" name="org.springframework.security.web" rev="3.0.2.RELEASE" conf="compile->runtime"/>
|
||||
<dependency org="org.springframework.webflow" name="org.springframework.faces" rev="latest.integration" conf="compile->jsf20"/>
|
||||
<dependency org="org.springframework.webflow" name="org.springframework.js" rev="latest.integration" conf="compile->runtime"/>
|
||||
<dependency org="org.springframework.webflow" name="org.springframework.webflow" rev="latest.integration" conf="compile->runtime"/>
|
||||
|
||||
<!-- Mojarra 2.0 (use in conjunction with JSF 2 version of faces-config.xml) -->
|
||||
<dependency org="org.springframework.webflow" name="org.springframework.faces" rev="latest.integration" conf="compile->mojarra20"/>
|
||||
|
||||
<!--
|
||||
Switching to Mojarra 1.2:
|
||||
1. Uncomment the below dependencies and comment out the mojarra20 dependency above.
|
||||
2. Update the contents of faces-config.xml with the one from faces-config-12.xml.
|
||||
3. Run 'ant clean jar' from the command line.
|
||||
4. Refresh the project in Eclipse.
|
||||
|
||||
<dependency org="org.springframework.webflow" name="org.springframework.faces" rev="latest.integration" conf="compile->mojarra12"/>
|
||||
<dependency org="com.sun.facelets" name="com.springsource.com.sun.facelets" rev="1.1.14" conf="compile->runtime" />
|
||||
-->
|
||||
|
||||
<!-- test-time only dependencies -->
|
||||
<dependency org="org.easymock" name="com.springsource.org.easymock" rev="2.3.0" conf="test->runtime" />
|
||||
<dependency org="org.junit" name="com.springsource.junit" rev="3.8.2" conf="test->runtime"/>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?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">
|
||||
|
||||
<!--
|
||||
|
||||
For use in a JSF 1.2 runtime environment.
|
||||
Swap this file out with faces-config.xml if testing with JSF 1.2 (see ivy.xml).
|
||||
|
||||
-->
|
||||
|
||||
<faces-config>
|
||||
<application>
|
||||
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
|
||||
</application>
|
||||
</faces-config>
|
||||
@@ -1,11 +1,9 @@
|
||||
<?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">
|
||||
<?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">
|
||||
|
||||
<faces-config>
|
||||
<application>
|
||||
<!-- Enables Facelets -->
|
||||
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
|
||||
</application>
|
||||
</faces-config>
|
||||
<application></application>
|
||||
|
||||
</faces-config>
|
||||
|
||||
@@ -89,6 +89,13 @@
|
||||
</h:selectOneRadio>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
The "amenities" section commented out due to the following issue:
|
||||
|
||||
https://issues.apache.org/jira/browse/MYFACES-2739
|
||||
https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=817
|
||||
https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1694
|
||||
|
||||
<div class="field">
|
||||
<div class="span-4">
|
||||
<h:outputLabel for="amenities">Amenities:</h:outputLabel>
|
||||
@@ -101,6 +108,8 @@
|
||||
</h:selectManyCheckbox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
-->
|
||||
<div class="field">
|
||||
<div class="span-4">
|
||||
<h:outputLabel for="creditCard">Credit Card #:</h:outputLabel>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
<f:view 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:h="http://java.sun.com/jsf/html"
|
||||
xmlns:c="http://java.sun.com/jsp/jstl/core"
|
||||
xmlns:sf="http://www.springframework.org/tags/faces"
|
||||
contentType="text/html" encoding="UTF-8">
|
||||
<html>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!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:c="http://java.sun.com/jstl/core"
|
||||
xmlns:c="http://java.sun.com/jsp/jstl/core"
|
||||
template="layouts/standard.xhtml">
|
||||
|
||||
<ui:define name="content">
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
<!-- Enables special Facelets debug output during development -->
|
||||
<context-param>
|
||||
<param-name>facelets.DEVELOPMENT</param-name>
|
||||
<param-value>true</param-value>
|
||||
<param-name>javax.faces.PROJECT_STAGE</param-name>
|
||||
<param-value>Development</param-value>
|
||||
</context-param>
|
||||
|
||||
<!-- Causes Facelets to refresh templates during development -->
|
||||
@@ -29,7 +29,13 @@
|
||||
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
|
||||
<param-value>1</param-value>
|
||||
</context-param>
|
||||
|
||||
|
||||
<!-- Disables partial state saving -->
|
||||
<context-param>
|
||||
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
|
||||
<param-value>false</param-value>
|
||||
</context-param>
|
||||
|
||||
<!-- Enforce UTF-8 Character Encoding -->
|
||||
<filter>
|
||||
<filter-name>charEncodingFilter</filter-name>
|
||||
@@ -60,17 +66,6 @@
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<!-- Sun JSF initialization listener. -->
|
||||
<listener>
|
||||
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- Appache MyFaces JSF initialization listener --><!--
|
||||
<listener>
|
||||
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
|
||||
</listener>
|
||||
-->
|
||||
|
||||
<!-- Loads the Spring web application context -->
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.junit/com.springsource.junit/3.8.2/com.springsource.junit-3.8.2.jar" sourcepath="/IVY_CACHE/org.junit/com.springsource.junit/3.8.2/com.springsource.junit-sources-3.8.2.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jsf-portlet.jar" sourcepath="lib/jsf-portlet-1.2.5-src.zip"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.portlet/com.springsource.javax.portlet/2.0.0/com.springsource.javax.portlet-2.0.0.jar" sourcepath="/IVY_CACHE/org.junit/com.springsource.junit/3.8.2/com.springsource.javax.portlet-sources-2.0.0.jar"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
#Thu Aug 09 13:12:30 EDT 2007
|
||||
#Wed Jun 02 12:02:05 BST 2010
|
||||
eclipse.preferences.version=1
|
||||
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<wb-module deploy-name="swf-booking-portlet-faces">
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
|
||||
<wb-resource deploy-path="/WEB-INF/lib" source-path="/target/war-expanded/WEB-INF/lib"/>
|
||||
<wb-resource deploy-path="/WEB-INF/lib" source-path="/lib"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<property name="java-output-path" value="target/classes"/>
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
<dependencies>
|
||||
<!-- core dependencies -->
|
||||
<dependency org="com.sun.facelets" name="com.springsource.com.sun.facelets" rev="1.1.14" conf="compile->compile"/>
|
||||
<dependency org="javax.el" name="com.springsource.javax.el" rev="1.0.0" conf="provided->compile"/>
|
||||
<dependency org="javax.persistence" name="com.springsource.javax.persistence" rev="1.0.0" conf="compile->compile"/>
|
||||
<dependency org="javax.portlet" name="com.springsource.javax.portlet" rev="2.0.0" conf="provided->compile"/>
|
||||
@@ -46,9 +45,11 @@
|
||||
<dependency org="org.springframework" name="org.springframework.web" rev="3.0.2.RELEASE" conf="compile->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.web.portlet" rev="3.0.2.RELEASE" conf="compile->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.web.servlet" rev="3.0.2.RELEASE" conf="compile->compile"/>
|
||||
<dependency org="org.springframework.webflow" name="org.springframework.faces" rev="latest.integration" conf="compile->jsf12"/>
|
||||
<dependency org="org.springframework.webflow" name="org.springframework.webflow" rev="latest.integration" conf="compile->compile"/>
|
||||
|
||||
<dependency org="org.springframework.webflow" name="org.springframework.faces" rev="latest.integration" conf="compile->myfaces12,myfacesPortlet20"/>
|
||||
<dependency org="com.sun.facelets" name="com.springsource.com.sun.facelets" rev="1.1.14" conf="compile->compile"/>
|
||||
|
||||
<!-- test-time only dependencies -->
|
||||
<dependency org="org.junit" name="com.springsource.junit" rev="3.8.2" conf="test->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.test" rev="3.0.2.RELEASE" conf="test->compile"/>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
15
spring-webflow-samples/booking-portlet-faces/readme.txt
Normal file
15
spring-webflow-samples/booking-portlet-faces/readme.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
The current status of this sample as of June 2, 2010 is 'not working'.
|
||||
|
||||
See notes below on combining JSF 1.2, Portlet 2.0, and Facelets.
|
||||
|
||||
JSF 2 is not yet supported by any jsf-portlet bridge implementation.
|
||||
The jsf-portlet bridges by Sun and Apache MyFaces support JSF 1.2.
|
||||
|
||||
Portlet 2.0 (required by Spring 3 and Spring Web Flow 2.1) is supported by Apache MyFaces only.
|
||||
|
||||
Official Facelets support is missing from both implementations. While there are some
|
||||
suggestions on how to create a PortletFaceletsViewHandler on the Apache MyFaces user
|
||||
list (see the thread referenced in the JavaDoc of the PortletFaceletsViewHandler in
|
||||
this project), the suggested solution doesn't appear to be complete.
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
package org.springframework.webflow.samples;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.faces.FacesException;
|
||||
import javax.faces.application.ViewHandler;
|
||||
import javax.faces.context.ExternalContext;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
import javax.faces.render.RenderKit;
|
||||
import javax.portlet.MimeResponse;
|
||||
import javax.portlet.faces.Bridge;
|
||||
|
||||
import com.sun.facelets.FaceletViewHandler;
|
||||
|
||||
/**
|
||||
* See: http://www.mail-archive.com/users@myfaces.apache.org/msg55213.html
|
||||
*/
|
||||
public class PortletFaceletViewHandler extends FaceletViewHandler {
|
||||
|
||||
public PortletFaceletViewHandler(ViewHandler parent) {
|
||||
super(new FaceletViewHandler(parent));
|
||||
}
|
||||
|
||||
protected ResponseWriter createResponseWriter(FacesContext context) throws IOException, FacesException {
|
||||
// Only override if in a portlet request
|
||||
if (context.getExternalContext().getRequestMap().get(Bridge.PORTLET_LIFECYCLE_PHASE) == null) {
|
||||
return super.createResponseWriter(context);
|
||||
}
|
||||
|
||||
ExternalContext extContext = context.getExternalContext();
|
||||
RenderKit renderKit = context.getRenderKit();
|
||||
// Avoid a cryptic NullPointerException when the renderkit ID
|
||||
// is incorrectly set
|
||||
if (renderKit == null) {
|
||||
String id = context.getViewRoot().getRenderKitId();
|
||||
throw new IllegalStateException("No render kit was available for id \"" + id + "\"");
|
||||
}
|
||||
|
||||
MimeResponse response = (MimeResponse) extContext.getResponse();
|
||||
|
||||
// get our content type
|
||||
String contentType = (String) extContext.getRequestMap().get("facelets.ContentType");
|
||||
|
||||
// get the encoding
|
||||
String encoding = (String) extContext.getRequestMap().get("facelets.Encoding");
|
||||
|
||||
ResponseWriter writer;
|
||||
// append */* to the contentType so createResponseWriter will succeed no matter
|
||||
// the requested contentType.
|
||||
if (contentType != null && !contentType.equals("*/*")) {
|
||||
contentType += ",*/*";
|
||||
}
|
||||
// Create a dummy ResponseWriter with a bogus writer,
|
||||
// so we can figure out what content type the ReponseWriter
|
||||
// is really going to ask for
|
||||
try {
|
||||
writer = renderKit.createResponseWriter(NullWriter.Instance, contentType, encoding);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// Added because of an RI bug prior to 1.2_05-b3. Might as well leave it in case other impls have the same
|
||||
// problem.
|
||||
// https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=613
|
||||
log.fine("The impl didn't correctly handled '*/*' in the content type list. Trying '*/*' directly.");
|
||||
writer = renderKit.createResponseWriter(NullWriter.Instance, "*/*", encoding);
|
||||
}
|
||||
|
||||
// Override the JSF provided content type if necessary
|
||||
contentType = getResponseContentType(context, writer.getContentType());
|
||||
encoding = getResponseEncoding(context, writer.getCharacterEncoding());
|
||||
|
||||
// apply them to the response
|
||||
response.setContentType(contentType + "; charset=" + encoding);
|
||||
|
||||
// removed 2005.8.23 to comply with J2EE 1.3
|
||||
// response.setCharacterEncoding(encoding);
|
||||
|
||||
// Now, clone with the real writer
|
||||
writer = writer.cloneWithWriter(response.getWriter());
|
||||
|
||||
return writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the encoding
|
||||
*
|
||||
* @param context
|
||||
* @param orig
|
||||
* @return
|
||||
*/
|
||||
protected String getResponseEncoding(FacesContext context, String orig) {
|
||||
String encoding = orig;
|
||||
|
||||
// see if we need to override the encoding
|
||||
Map m = context.getExternalContext().getRequestMap();
|
||||
Map sm = context.getExternalContext().getSessionMap();
|
||||
|
||||
// 1. check the request attribute
|
||||
if (m.containsKey("facelets.Encoding")) {
|
||||
encoding = (String) m.get("facelets.Encoding");
|
||||
if (log.isLoggable(Level.FINEST)) {
|
||||
log.finest("Facelet specified alternate encoding '" + encoding + "'");
|
||||
}
|
||||
sm.put(CHARACTER_ENCODING_KEY, encoding);
|
||||
}
|
||||
|
||||
// 2. get it from request
|
||||
if (encoding == null) {
|
||||
encoding = context.getExternalContext().getResponseCharacterEncoding();
|
||||
}
|
||||
|
||||
// 3. get it from the session
|
||||
if (encoding == null) {
|
||||
encoding = (String) sm.get(CHARACTER_ENCODING_KEY);
|
||||
if (log.isLoggable(Level.FINEST)) {
|
||||
log.finest("Session specified alternate encoding '" + encoding + "'");
|
||||
}
|
||||
}
|
||||
|
||||
// 4. default it
|
||||
if (encoding == null) {
|
||||
encoding = "UTF-8";
|
||||
if (log.isLoggable(Level.FINEST)) {
|
||||
log.finest("ResponseWriter created had a null CharacterEncoding, defaulting to UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
return encoding;
|
||||
}
|
||||
|
||||
protected static class NullWriter extends Writer {
|
||||
|
||||
static final NullWriter Instance = new NullWriter();
|
||||
|
||||
public void write(char[] buffer) {
|
||||
}
|
||||
|
||||
public void write(char[] buffer, int off, int len) {
|
||||
}
|
||||
|
||||
public void write(String str) {
|
||||
}
|
||||
|
||||
public void write(int c) {
|
||||
}
|
||||
|
||||
public void write(String str, int off, int len) {
|
||||
}
|
||||
|
||||
public void close() {
|
||||
}
|
||||
|
||||
public void flush() {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,6 @@
|
||||
<faces-config>
|
||||
<application>
|
||||
<!-- Enables Facelets -->
|
||||
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
|
||||
<view-handler>org.springframework.webflow.samples.PortletFaceletViewHandler</view-handler>
|
||||
</application>
|
||||
</faces-config>
|
||||
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<pageflow:Pageflow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pageflow="http://www.sybase.com/suade/pageflow" id="pf12064681529860" configfile="/jsf-booking/src/main/webapp/WEB-INF/faces-config.xml">
|
||||
<nodes xsi:type="pageflow:PFPage" name="*" id="pf12064726747627" outlinks="pf120647423764116 pf120647433267418 pf12065417489470 pf12065437582792 pf12065438084374 pf12065438433186 pf12065713044628 pf12065730907119" path="*"/>
|
||||
<nodes xsi:type="pageflow:PFPage" name="main/reviewHotels.xhtml" id="pf120647423764117" referenceLink="//@navigationRule.0/@navigationCase.1/@toViewId|" inlinks="pf120647423764116" path="/main/reviewHotels.xhtml"/>
|
||||
<nodes xsi:type="pageflow:PFPage" name="main/enterSearchCriteria.xhtml" id="pf120647433267419" referenceLink="//@navigationRule.0/@navigationCase.6/@toViewId|" inlinks="pf120647433267418 pf12065437582792 pf12065730907119" path="/main/enterSearchCriteria.xhtml"/>
|
||||
<nodes xsi:type="pageflow:PFPage" name="main/reviewHotel.xhtml" id="pf12065417489561" referenceLink="//@navigationRule.0/@navigationCase.2/@toViewId|" inlinks="pf12065417489470" path="/main/reviewHotel.xhtml"/>
|
||||
<nodes xsi:type="pageflow:PFPage" name="booking/reviewBooking.xhtml" id="pf12065438084375" referenceLink="//@navigationRule.0/@navigationCase.7/@toViewId|" inlinks="pf12065438084374" path="/booking/reviewBooking.xhtml"/>
|
||||
<nodes xsi:type="pageflow:PFPage" name="booking/enterBookingDetails.xhtml" id="pf12065438433197" referenceLink="//@navigationRule.0/@navigationCase.4/@toViewId|" inlinks="pf12065438433186 pf12065713044628" path="/booking/enterBookingDetails.xhtml"/>
|
||||
<links id="pf120647423764116" target="pf120647423764117" source="pf12064726747627" outcome="reviewHotels"/>
|
||||
<links id="pf120647433267418" target="pf120647433267419" source="pf12064726747627" outcome="changeSearch"/>
|
||||
<links id="pf12065417489470" target="pf12065417489561" source="pf12064726747627" outcome="select"/>
|
||||
<links id="pf12065437582792" target="pf120647433267419" source="pf12064726747627" outcome="cancel"/>
|
||||
<links id="pf12065438084374" target="pf12065438084375" source="pf12064726747627" outcome="reviewBooking"/>
|
||||
<links id="pf12065438433186" target="pf12065438433197" source="pf12064726747627" outcome="book"/>
|
||||
<links id="pf12065713044628" target="pf12065438433197" source="pf12064726747627" outcome="revise"/>
|
||||
<links id="pf12065730907119" target="pf120647433267419" source="pf12064726747627" outcome="confirm"/>
|
||||
<nodes xsi:type="pageflow:PFPage" name="*" x="122" y="178" id="pf12064726747627" outlinks="pf120647433267418" path="*"/>
|
||||
<nodes xsi:type="pageflow:PFPage" name="main/reviewHotels.xhtml" x="554" y="356" id="pf120647423764117" referenceLink="//@navigationRule.1/@fromViewId|" outlinks="pf12754702437321 pf12754702437322" inlinks="pf12754702437323" path="/main/reviewHotels.xhtml"/>
|
||||
<nodes xsi:type="pageflow:PFPage" name="main/enterSearchCriteria.xhtml" x="338" y="356" id="pf120647433267419" referenceLink="//@navigationRule.5/@navigationCase.0/@toViewId|" outlinks="pf12754702437323" inlinks="pf120647433267418 pf12754702437321 pf12754702437324" path="/main/enterSearchCriteria.xhtml"/>
|
||||
<nodes xsi:type="pageflow:PFPage" name="main/reviewHotel.xhtml" x="770" y="356" id="pf12065417489561" referenceLink="//@navigationRule.2/@fromViewId|" outlinks="pf12754702437325" inlinks="pf12754702437322" path="/main/reviewHotel.xhtml"/>
|
||||
<nodes xsi:type="pageflow:PFPage" name="booking/reviewBooking.xhtml" x="122" y="562" id="pf12065438084375" referenceLink="//@navigationRule.4/@fromViewId|" outlinks="pf12754702437326 pf12754702437324" inlinks="pf12754702437327" path="/booking/reviewBooking.xhtml"/>
|
||||
<nodes xsi:type="pageflow:PFPage" name="booking/enterBookingDetails.xhtml" x="986" y="558" id="pf12065438433197" referenceLink="//@navigationRule.4/@navigationCase.0/@toViewId|" outlinks="pf12754702437327" inlinks="pf12754702437325 pf12754702437326" path="/booking/enterBookingDetails.xhtml"/>
|
||||
<links id="pf120647433267418" target="pf120647433267419" source="pf12064726747627" outcome="cancel"/>
|
||||
<links id="pf12754702437323" target="pf120647423764117" source="pf120647433267419" outcome="reviewHotels"/>
|
||||
<links id="pf12754702437321" target="pf120647433267419" source="pf120647423764117" outcome="changeSearch"/>
|
||||
<links id="pf12754702437322" target="pf12065417489561" source="pf120647423764117" outcome="select"/>
|
||||
<links id="pf12754702437325" target="pf12065438433197" source="pf12065417489561" outcome="book"/>
|
||||
<links id="pf12754702437327" target="pf12065438084375" source="pf12065438433197" outcome="reviewBooking"/>
|
||||
<links id="pf12754702437326" target="pf12065438433197" source="pf12065438084375" outcome="revise"/>
|
||||
<links id="pf12754702437324" target="pf120647433267419" source="pf12065438084375" outcome="confirm"/>
|
||||
</pageflow:Pageflow>
|
||||
|
||||
@@ -21,13 +21,12 @@
|
||||
|
||||
<dependencies>
|
||||
<!-- core dependencies -->
|
||||
<dependency org="com.sun.facelets" name="com.springsource.com.sun.facelets" rev="1.1.14" conf="compile->runtime"/>
|
||||
<dependency org="javax.el" name="com.springsource.javax.el" rev="1.0.0" conf="provided->runtime"/>
|
||||
<dependency org="javax.faces" name="jsf-api" rev="2.0" conf="compile->runtime" />
|
||||
<dependency org="com.sun.faces" name="jsf-impl" rev="2.0.2" conf="compile->runtime" />
|
||||
<dependency org="javax.faces" name="jsf-api" rev="2.0" conf="compile->runtime(*)" />
|
||||
<dependency org="com.sun.faces" name="jsf-impl" rev="2.0.2" conf="compile->runtime(*)" />
|
||||
<dependency org="javax.persistence" name="com.springsource.javax.persistence" rev="1.0.0" conf="compile->runtime"/>
|
||||
<dependency org="javax.servlet" name="com.springsource.javax.servlet" rev="2.4.0" conf="provided->runtime"/>
|
||||
<dependency org="javax.servlet" name="com.springsource.javax.servlet.jsp.jstl" rev="1.1.2" conf="compile->runtime"/>
|
||||
<dependency org="javax.servlet" name="com.springsource.javax.servlet.jsp.jstl" rev="1.2.0" conf="compile->runtime"/>
|
||||
<dependency org="javax.transaction" name="com.springsource.javax.transaction" rev="1.1.0" conf="compile->runtime"/>
|
||||
<dependency org="org.apache.log4j" name="com.springsource.org.apache.log4j" rev="1.2.15" conf="compile->runtime"/>
|
||||
<dependency org="org.hibernate" name="com.springsource.org.hibernate" rev="3.2.6.ga" conf="compile->runtime"/>
|
||||
|
||||
@@ -3,22 +3,30 @@ package org.springframework.webflow.samples.booking.jsf;
|
||||
import java.util.Calendar;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.bean.ManagedBean;
|
||||
import javax.faces.bean.ManagedProperty;
|
||||
import javax.faces.bean.RequestScoped;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.springframework.webflow.samples.booking.Booking;
|
||||
import org.springframework.webflow.samples.booking.BookingService;
|
||||
import org.springframework.webflow.samples.booking.Hotel;
|
||||
|
||||
@ManagedBean
|
||||
@RequestScoped
|
||||
public class BookingController {
|
||||
|
||||
@ManagedProperty("#{bookingService}")
|
||||
private BookingService bookingService;
|
||||
|
||||
@ManagedProperty("#{hotelController.hotelId}")
|
||||
private Long hotelId;
|
||||
|
||||
private Hotel hotel = new Hotel();
|
||||
|
||||
@ManagedProperty("#{booking}")
|
||||
private Booking booking;
|
||||
|
||||
private Hotel hotel = new Hotel();
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
public void setBookingService(BookingService bookingService) {
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
package org.springframework.webflow.samples.booking.jsf;
|
||||
|
||||
import javax.faces.bean.ManagedBean;
|
||||
import javax.faces.bean.ManagedProperty;
|
||||
import javax.faces.bean.RequestScoped;
|
||||
|
||||
import org.springframework.webflow.samples.booking.BookingService;
|
||||
import org.springframework.webflow.samples.booking.Hotel;
|
||||
|
||||
@ManagedBean
|
||||
@RequestScoped
|
||||
public class HotelController {
|
||||
|
||||
@ManagedProperty("#{bookingService}")
|
||||
private BookingService bookingService;
|
||||
|
||||
@ManagedProperty("#{param.id}")
|
||||
private Long hotelId;
|
||||
|
||||
private Hotel hotel;
|
||||
|
||||
@@ -2,6 +2,9 @@ package org.springframework.webflow.samples.booking.jsf;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.bean.ManagedBean;
|
||||
import javax.faces.bean.ManagedProperty;
|
||||
import javax.faces.bean.RequestScoped;
|
||||
import javax.faces.event.ActionEvent;
|
||||
import javax.faces.model.DataModel;
|
||||
import javax.faces.model.ListDataModel;
|
||||
@@ -10,6 +13,8 @@ import org.springframework.webflow.samples.booking.Booking;
|
||||
import org.springframework.webflow.samples.booking.BookingService;
|
||||
import org.springframework.webflow.samples.booking.SearchCriteria;
|
||||
|
||||
@ManagedBean
|
||||
@RequestScoped
|
||||
public class SearchController {
|
||||
|
||||
private SearchCriteria searchCriteria;
|
||||
@@ -18,6 +23,7 @@ public class SearchController {
|
||||
|
||||
private DataModel hotels;
|
||||
|
||||
@ManagedProperty("#{bookingService}")
|
||||
private BookingService bookingService;
|
||||
|
||||
public void setBookingService(BookingService bookingService) {
|
||||
|
||||
@@ -1,77 +1,13 @@
|
||||
<?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>
|
||||
<?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>
|
||||
<variable-resolver>org.springframework.web.jsf.SpringBeanVariableResolver</variable-resolver>
|
||||
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
|
||||
</application>
|
||||
|
||||
<managed-bean>
|
||||
<managed-bean-name>searchController</managed-bean-name>
|
||||
<managed-bean-class>org.springframework.webflow.samples.booking.jsf.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.jsf.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.jsf.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>
|
||||
|
||||
<navigation-rule>
|
||||
<from-view-id>/main/enterSearchCriteria.xhtml</from-view-id>
|
||||
<navigation-case>
|
||||
<from-outcome>reviewHotels</from-outcome>
|
||||
<to-view-id>/main/reviewHotels.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
</navigation-rule>
|
||||
|
||||
<navigation-rule>
|
||||
<from-view-id>/main/reviewHotels.xhtml</from-view-id>
|
||||
<navigation-case>
|
||||
<from-outcome>changeSearch</from-outcome>
|
||||
<to-view-id>/main/enterSearchCriteria.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-rule>
|
||||
|
||||
<navigation-rule>
|
||||
<from-view-id>/main/reviewHotel.xhtml</from-view-id>
|
||||
<navigation-case>
|
||||
@@ -80,14 +16,6 @@
|
||||
</navigation-case>
|
||||
</navigation-rule>
|
||||
|
||||
<navigation-rule>
|
||||
<from-view-id>/booking/enterBookingDetails.xhtml</from-view-id>
|
||||
<navigation-case>
|
||||
<from-outcome>reviewBooking</from-outcome>
|
||||
<to-view-id>/booking/reviewBooking.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
</navigation-rule>
|
||||
|
||||
<navigation-rule>
|
||||
<from-view-id>/booking/reviewBooking.xhtml</from-view-id>
|
||||
<navigation-case>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<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:c="http://java.sun.com/jsp/jstl/core"
|
||||
xmlns:sf="http://www.springframework.org/tags/faces">
|
||||
<f:view contentType="text/html">
|
||||
<head>
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
<!-- Enables special Facelets debug output during development -->
|
||||
<context-param>
|
||||
<param-name>facelets.DEVELOPMENT</param-name>
|
||||
<param-value>true</param-value>
|
||||
<param-name>javax.faces.PROJECT_STAGE</param-name>
|
||||
<param-value>Development</param-value>
|
||||
</context-param>
|
||||
|
||||
<!-- Causes Facelets to refresh templates during development -->
|
||||
@@ -29,17 +29,6 @@
|
||||
<param-value>1</param-value>
|
||||
</context-param>
|
||||
|
||||
<!-- Sun JSF initialization listener. -->
|
||||
<listener>
|
||||
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- Appache MyFaces JSF initialization listener --><!--
|
||||
<listener>
|
||||
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
|
||||
</listener>
|
||||
-->
|
||||
|
||||
<!-- Loads the Spring web application context -->
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
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">
|
||||
@@ -46,11 +45,9 @@
|
||||
<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>
|
||||
<h:inputText id="checkinDate" value="#{bookingController.booking.checkinDate}" required="true">
|
||||
<f:convertDateTime pattern="yyyy-MM-dd" timeZone="EST"/>
|
||||
</h:inputText>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
@@ -58,11 +55,9 @@
|
||||
<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>
|
||||
<h:inputText id="checkoutDate" value="#{bookingController.booking.checkoutDate}" required="true">
|
||||
<f:convertDateTime pattern="yyyy-MM-dd" timeZone="EST"/>
|
||||
</h:inputText>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
@@ -90,9 +85,7 @@
|
||||
<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>
|
||||
<h:inputText id="creditCard" value="#{bookingController.booking.creditCard}" required="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
@@ -100,9 +93,7 @@
|
||||
<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>
|
||||
<h:inputText id="creditCardName" value="#{bookingController.booking.creditCardName}" required="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="section">
|
||||
<h2>Hotel Results</h2>
|
||||
<p>
|
||||
<h:commandLink value="Change Search" action="changeSearch"/>
|
||||
<h:commandLink value="Change Search" action="enterSearchCriteria"/>
|
||||
</p>
|
||||
|
||||
<div id="searchResults">
|
||||
|
||||
Reference in New Issue
Block a user