diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/config/webflow-config.xml b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/config/webflow-config.xml index 20cfdcf2..1b460c29 100644 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/config/webflow-config.xml +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/config/webflow-config.xml @@ -17,10 +17,16 @@ - + + + + + + + diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/config/webmvc-config.xml b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/config/webmvc-config.xml index 2a4ace15..a8dade36 100644 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/config/webmvc-config.xml +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/config/webmvc-config.xml @@ -32,10 +32,21 @@ - - - - + + + + + /WEB-INF/layouts/layouts.xml + /WEB-INF/views.xml + /WEB-INF/hotels/views.xml + /WEB-INF/hotels/booking/views.xml + + + + + + + @@ -49,7 +60,4 @@ - - - \ No newline at end of file diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/enterBookingDetails.jsp b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/enterBookingDetails.jsp index cc6dfc05..e562f127 100644 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/enterBookingDetails.jsp +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/enterBookingDetails.jsp @@ -1,11 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> - - -

Book Hotel

@@ -40,12 +36,19 @@ ${status.value} -
+
+
@@ -54,6 +57,13 @@
+
@@ -70,11 +80,23 @@
- + Smoking Preference:
- + + +
@@ -82,7 +104,14 @@
- + +
@@ -90,7 +119,14 @@
- + +
@@ -122,12 +158,12 @@
-   +     +
- -
-
\ No newline at end of file diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/reviewBooking.jsp b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/reviewBooking.jsp index 8fa4f4db..9251b74d 100644 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/reviewBooking.jsp +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/reviewBooking.jsp @@ -1,11 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> - - -

Confirm Hotel Booking

@@ -63,6 +59,3 @@ - -
-
\ No newline at end of file diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/views.xml b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/views.xml new file mode 100644 index 00000000..47155308 --- /dev/null +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/views.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/index.jsp b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/index.jsp index 01266add..0d95398a 100644 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/index.jsp +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/index.jsp @@ -1,19 +1,22 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> - - -

Search Hotels

-
+
+ @@ -64,6 +67,3 @@
- -
-
\ No newline at end of file diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/search.jsp b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/search.jsp index 3ef0b00f..66630367 100644 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/search.jsp +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/search.jsp @@ -1,10 +1,6 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> - - -

Hotel Results

@@ -42,6 +38,3 @@ - -
-
\ No newline at end of file diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/show.jsp b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/show.jsp index a8ff82bf..6dc285cd 100644 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/show.jsp +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/show.jsp @@ -1,11 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> - - -

View Hotel

@@ -50,6 +46,3 @@ - -
-
\ No newline at end of file diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/views.xml b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/views.xml new file mode 100644 index 00000000..5c02003b --- /dev/null +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/views.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/intro.jsp b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/intro.jsp index 3c087537..47f45b1f 100755 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/intro.jsp +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/intro.jsp @@ -1,8 +1,4 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %> - - -

Welcome to Spring Travel

@@ -28,6 +24,3 @@ Start your Spring Travel experience

- -
-
diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/layouts/layouts.xml b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/layouts/layouts.xml new file mode 100644 index 00000000..6df28422 --- /dev/null +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/layouts/layouts.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/layouts/standard.jsp b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/layouts/standard.jsp index eeb8519e..9ee281a2 100644 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/layouts/standard.jsp +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/layouts/standard.jsp @@ -15,6 +15,10 @@ @import url(""); @import url(""); + + + + " />
@@ -49,7 +53,7 @@

- +
- - - - \ No newline at end of file diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/logout-success.jsp b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/logout-success.jsp index 1a998b74..b0023b66 100755 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/logout-success.jsp +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/logout-success.jsp @@ -1,16 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %> - - - -

Logout

You have successfully logged out.

">Continue

- - -
-
\ No newline at end of file diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/views.xml b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/views.xml new file mode 100644 index 00000000..9fcd9463 --- /dev/null +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/views.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/spring/Spring-Dojo.js b/spring-webflow-samples/booking-mvc/src/main/webapp/spring/Spring-Dojo.js new file mode 100644 index 00000000..5dc2f25c --- /dev/null +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/spring/Spring-Dojo.js @@ -0,0 +1,343 @@ +/* + * Copyright 2004-2008 the original author or authors. + * + * 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. + */ +Spring.DojoValidatingFieldAdvisor = function(config){ + + dojo.mixin(this, config); +}; + +Spring.DojoValidatingFieldAdvisor.prototype = { + + targetElId : "", + decoratorType : null, + decorator : null, + decoratorAttrs : null, + copyFields : new Array('name', 'value', 'type', 'checked', 'selected', 'readOnly', 'disabled', 'alt', 'maxLength'), + + apply : function(){ + if (dijit.byId(this.targetElId)) { + dijit.byId(this.targetElId).destroyRecursive(false); + } + var targetEl = dojo.byId(this.targetElId); + for (var copyField in this.copyFields) { + copyField = this.copyFields[copyField]; + if (!this.decoratorAttrs[copyField] && targetEl[copyField] && (typeof targetEl[copyField] != 'number' || (typeof targetEl[copyField] == 'number' && targetEl[copyField] >= 0))) { + this.decoratorAttrs[copyField] = targetEl[copyField]; + } + } + this.decorator = new this.decoratorType(this.decoratorAttrs, targetEl); + this.decorator.startup(); + //return this to support method chaining + return this; + }, + + validate : function(){ + if (!this.decorator.isValid) { + // some decorators cannot be validated + return true; + } + var isValid = this.decorator.isValid(false); + if (!isValid) { + this.decorator.state = "Error"; + this.decorator._setStateClass(); + } + return isValid; + } +}; + +Spring.ValidatingFieldAdvisor = Spring.DojoValidatingFieldAdvisor; + +Spring.DojoRemoteEventAdvisor = function(config){ + dojo.mixin(this, config); +}; + +Spring.DojoRemoteEventAdvisor.prototype = { + + event : "", + targetId : "", + sourceId : "", + formId : "", + processIds : "", + renderIds : "", + params : [], + connection : null, + + apply : function() { + this.connection = dojo.connect(dojo.byId(this.targetId), this.event, this, "submit"); + return this; + }, + + cleanup : function(){ + dojo.disconnect(this.connection); + }, + + submit : function(){ + Spring.RemotingHandler.submitForm(this.sourceId, this.formId, this.processIds, this.renderIds, this.params); + } +}; + +Spring.RemoteEventAdvisor = Spring.DojoRemoteEventAdvisor; + +Spring.DojoValidateAllAdvisor = function(config){ + dojo.mixin(this, config); +}; + +Spring.DojoValidateAllAdvisor.prototype = { + + event : "", + targetId : "", + originalHandler : null, + connection : null, + + apply : function() { + var targetEl = dojo.byId(this.targetId); + this.originalHandler = targetEl[this.event]; + var context = this; + targetEl[this.event] = function(event){ + context.handleEvent(event, context); + }; + return this; + }, + + cleanup : function(){ + dojo.disconnect(this.connection); + }, + + handleEvent : function(event, context){ + if (!Spring.validateAll()) { + dojo.stopEvent(event); + } else { + var result = context.originalHandler(event); + if (result == false) { + dojo.stopEvent(event); + } + } + } +}; + +Spring.ValidateAllAdvisor = Spring.DojoValidateAllAdvisor; + +Spring.DojoRemotingHandler = function(){}; + +Spring.DojoRemotingHandler.prototype = { + + submitForm : function(/*String */ sourceId, /*String*/formId, /*String*/ processIds, /*String*/renderIds, /*Array*/ params) { + var content = new Object(); + var sourceComponent = dojo.byId(sourceId); + content['processIds'] = processIds; + content['renderIds'] = renderIds; + + if (sourceComponent != null){ + if(sourceComponent.value) { + content[sourceId] = sourceComponent.value; + } else { + content[sourceId] = sourceId; + } + } + + dojo.forEach(params, function(param){ + content[param.name] = param.value; + }); + + content['ajaxSource'] = sourceId; + + dojo.xhrPost({ + + content: content, + + form: formId, + + handleAs: "text", + + headers: {"Accept" : "text/html;type=ajax"}, + + // The LOAD function will be called on a successful response. + load: this.handleResponse, + + // The ERROR function will be called in an error case. + error: this.handleError + }); + + }, + + getLinkedResource: function(/*String */ linkId, /*boolean*/ modal) { + this.getResource(dojo.byId(linkId).href, modal); + }, + + getResource: function(/*String */ resourceUri, /*boolean*/ modal) { + + dojo.xhrGet({ + + url: resourceUri, + + handleAs: "text", + + load: this.handleResponse, + + error: this.handleError, + + modal: modal + }); + }, + + handleResponse: function(response, ioArgs) { + + //First check if this response should redirect + var redirectURL = ioArgs.xhr.getResponseHeader('Flow-Redirect-URL'); + var modalViewHeader = ioArgs.xhr.getResponseHeader('Flow-Modal-View'); + var modalView = ((dojo.isString(modalViewHeader) && modalViewHeader.length > 0) || ioArgs.args.modal); + + if (dojo.isString(redirectURL) && redirectURL.length > 0) { + if (modalView) { + //render a popup with the new URL + Spring.RemotingHandler.renderURLToModalDialog(redirectURL, ioArgs); + return response; + } + else { + window.location = window.location.protocol + "//" + window.location.host + redirectURL; + return response; + } + } + + //Extract and store all