Moved Spring Web Flow to a top level project
10
spring-webflow-samples/birthdate/.classpath
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.5"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
|
||||
<classpathentry kind="lib" path="lib/test/junit.jar"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
8
spring-webflow-samples/birthdate/.cvsignore
Normal file
@@ -0,0 +1,8 @@
|
||||
target
|
||||
lib
|
||||
bak
|
||||
build.properties
|
||||
*.log
|
||||
*.jpx.local*
|
||||
*.iws
|
||||
*.tws
|
||||
36
spring-webflow-samples/birthdate/.project
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>swf-birthdate</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</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.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,8 @@
|
||||
#Mon Nov 13 17:29:33 PST 2006
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
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
|
||||
@@ -0,0 +1,3 @@
|
||||
#Mon Nov 13 17:29:33 PST 2006
|
||||
eclipse.preferences.version=1
|
||||
internal.default.compliance=default
|
||||
@@ -0,0 +1,4 @@
|
||||
#Mon Nov 13 17:23:47 PST 2006
|
||||
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER/owners=jst.java\:5.0
|
||||
classpath.helper/org.eclipse.jst.server.core.container\:\:org.eclipse.jst.server.tomcat.runtimeTarget\:\:Apache\ Tomcat\ v5.5/owners=jst.web\:2.4
|
||||
eclipse.preferences.version=1
|
||||
81
spring-webflow-samples/birthdate/.settings/org.eclipse.wst.common.component
Executable file
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="swf-birthdate">
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/standard.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/spring-webflow.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/spring-web.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/spring-core.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/spring-context.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/spring-binding.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/spring-beans.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/ognl.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/log4j.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/junit.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/jstl.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/commons-logging.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/commons-codec.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/commons-beanutils.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/xml-apis.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/xalan.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/struts.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/spring-struts.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/oro.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/commons-validator.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/commons-fileupload.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/commons-digester.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/commons-collections.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-birthdate/lib/global/antlr.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="java-output-path" value="target/classes"/>
|
||||
<property name="context-root" value="swf-birthdate"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="jst.web"/>
|
||||
<fixed facet="jst.java"/>
|
||||
<installed facet="jst.web" version="2.4"/>
|
||||
<installed facet="jst.java" version="5.0"/>
|
||||
</faceted-project>
|
||||
@@ -0,0 +1,6 @@
|
||||
#Mon Nov 13 17:29:33 PST 2006
|
||||
DELEGATES_PREFERENCE=delegateValidatorListorg.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator\=org.eclipse.wst.wsdl.validation.internal.eclipse.Validator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator\=org.eclipse.wst.xsd.core.internal.validation.eclipse.Validator;
|
||||
USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.html.internal.validation.HTMLValidator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;org.eclipse.jst.j2ee.internal.web.validation.UIWarValidator;org.eclipse.jst.jsp.core.internal.validation.JSPELValidator;org.eclipse.jst.jsp.core.internal.validation.JSPJavaValidator;org.eclipse.jst.jsp.core.internal.validation.JSPDirectiveValidator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;
|
||||
USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.html.internal.validation.HTMLValidator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;org.eclipse.jst.j2ee.internal.web.validation.UIWarValidator;org.eclipse.jst.jsp.core.internal.validation.JSPELValidator;org.eclipse.jst.jsp.core.internal.validation.JSPJavaValidator;org.eclipse.jst.jsp.core.internal.validation.JSPDirectiveValidator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;
|
||||
USER_PREFERENCE=overrideGlobalPreferencesfalse
|
||||
eclipse.preferences.version=1
|
||||
10
spring-webflow-samples/birthdate/.springBeans
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beansProjectDescription>
|
||||
<configExtensions>
|
||||
<configExtension>xml</configExtension>
|
||||
</configExtensions>
|
||||
<configs>
|
||||
</configs>
|
||||
<configSets>
|
||||
</configSets>
|
||||
</beansProjectDescription>
|
||||
16
spring-webflow-samples/birthdate/build.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project name="swf-birthdate" default="dist">
|
||||
|
||||
<property file="build.properties"/>
|
||||
<property file="project.properties"/>
|
||||
<property file="${common.build.dir}/build.properties"/>
|
||||
<property file="${common.build.dir}/project.properties"/>
|
||||
<property file="${user.home}/build.properties"/>
|
||||
|
||||
<property name="build.web" value="true"/>
|
||||
|
||||
<import file="${common.build.dir}/common-targets.xml"/>
|
||||
<import file="${common.build.dir}/tomcat-targets.xml"/>
|
||||
|
||||
</project>
|
||||
23
spring-webflow-samples/birthdate/ivy.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<ivy-module version="1.1">
|
||||
|
||||
<info organisation="org.springframework" module="swf-birthdate"/>
|
||||
|
||||
<configurations>
|
||||
<conf name="default" extends="global"/>
|
||||
<conf name="global" visibility="private"/>
|
||||
<conf name="buildtime" visibility="private"/>
|
||||
<conf name="test" visibility="private"/>
|
||||
</configurations>
|
||||
|
||||
<dependencies defaultconf="global->default">
|
||||
<!-- global (core) dependencies -->
|
||||
<dependency org="log4j" name="log4j" rev="1.2.13"/>
|
||||
<dependency org="taglibs" name="standard" rev="1.1.2"/>
|
||||
<dependency org="jstl" name="jstl" rev="1.1.2"/>
|
||||
<dependency org="org.springframework" name="spring-webflow" rev="latest.integration" conf="global->struts"/>
|
||||
|
||||
<!-- test time only dependencies -->
|
||||
<dependency org="junit" name="junit" rev="3.8.1" conf="test->default"/>
|
||||
</dependencies>
|
||||
|
||||
</ivy-module>
|
||||
10
spring-webflow-samples/birthdate/project.properties
Normal file
@@ -0,0 +1,10 @@
|
||||
# properties defined in this file are overridable by a local build.properties in this project dir
|
||||
|
||||
# The location of the common build system
|
||||
common.build.dir=${basedir}/../../common-build
|
||||
|
||||
javac.source=1.3
|
||||
javac.target=1.3
|
||||
|
||||
# Do not publish built artifacts to the integration repository
|
||||
do.publish=false
|
||||
33
spring-webflow-samples/birthdate/src/etc/filter.properties
Normal file
@@ -0,0 +1,33 @@
|
||||
# $Header$
|
||||
|
||||
# Contains filterable project settings. Setting placeholders in filterable project text
|
||||
# files will be replaced with these values when the 'statics' build target is run.
|
||||
#
|
||||
# You may add static settings directly to this source file in the format:
|
||||
# setting=value e.g MY_SETTING=myvalue
|
||||
# This is appropriate usage if you know the setting value will never change.
|
||||
#
|
||||
# At build time this source file is copied to the ${target.dir} where additional
|
||||
# dynamic settings may be appended using the <propertyfile> task. Use this approach
|
||||
# when a setting value depends on the build or the local user's environment.
|
||||
#
|
||||
# An example of this approach is shown below:
|
||||
#
|
||||
# build.xml
|
||||
# <target name="build.prepare" depends="common-targets.build.prepare">
|
||||
# <!-- Append additional local settings that are applicable to this project -->
|
||||
# <propertyfile file="${target.filter.file}">
|
||||
# <!-- key=the name of the setting
|
||||
# value=the property in your build.properties file that has the local setting value -->
|
||||
# <entry key="MY_LOCAL_SETTING" value="${my.local.setting}" />
|
||||
# </propertyfile>
|
||||
# </target>
|
||||
#
|
||||
# This allows for dynamic replacement values that are sourced from local properties files to facilitate
|
||||
# local user settings.
|
||||
#
|
||||
# To refer to filterable settings within project source files like config files, JSPs, or
|
||||
# other text files use the standard ant placeholder format:
|
||||
# @SETTING_NAME@ e.g, @MY_SETTING@ and @MY_LOCAL_SETTING@
|
||||
#
|
||||
# Your settings:
|
||||
@@ -0,0 +1,15 @@
|
||||
log4j.rootCategory=DEBUG, stdout, logfile
|
||||
|
||||
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
|
||||
|
||||
log4j.appender.logfile=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.logfile.File=@TEST_RESULTS_DIR@/@PROJECT_NAME@.log
|
||||
log4j.appender.logfile.MaxFileSize=512KB
|
||||
|
||||
# Keep three backup files
|
||||
log4j.appender.logfile.MaxBackupIndex=3
|
||||
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
|
||||
#Pattern to output : date priority [category] - <message>line_separator
|
||||
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - <%m>%n
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2002-2006 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.
|
||||
*/
|
||||
package org.springframework.webflow.samples.birthdate;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class BirthDate implements Serializable {
|
||||
|
||||
private String name;
|
||||
|
||||
private Date date;
|
||||
|
||||
private boolean sendCard;
|
||||
|
||||
private String emailAddress;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public boolean isSendCard() {
|
||||
return sendCard;
|
||||
}
|
||||
|
||||
public void setSendCard(boolean sendCard) {
|
||||
this.sendCard = sendCard;
|
||||
}
|
||||
|
||||
public String getEmailAddress() {
|
||||
return emailAddress;
|
||||
}
|
||||
|
||||
public void setEmailAddress(String emailAddress) {
|
||||
this.emailAddress = emailAddress;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright 2002-2006 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.
|
||||
*/
|
||||
package org.springframework.webflow.samples.birthdate;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import org.springframework.beans.PropertyEditorRegistry;
|
||||
import org.springframework.beans.propertyeditors.CustomDateEditor;
|
||||
import org.springframework.webflow.action.FormAction;
|
||||
import org.springframework.webflow.execution.Event;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
import org.springframework.webflow.execution.ScopeType;
|
||||
|
||||
public class BirthDateFormAction extends FormAction {
|
||||
|
||||
// standard European format
|
||||
private static final String BIRTH_DATE_PATTERN = "dd-MM-yyyy";
|
||||
|
||||
private static final String AGE_NAME = "age";
|
||||
|
||||
public BirthDateFormAction() {
|
||||
// tell the superclass about the form object and validator we want to use
|
||||
// you could also do this in the application context XML ofcourse
|
||||
setFormObjectName("birthDate");
|
||||
setFormObjectClass(BirthDate.class);
|
||||
setFormObjectScope(ScopeType.FLOW);
|
||||
setValidator(new BirthDateValidator());
|
||||
}
|
||||
|
||||
protected void registerPropertyEditors(PropertyEditorRegistry registry) {
|
||||
// register a custom property editor to handle the date input
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(BIRTH_DATE_PATTERN);
|
||||
registry.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
|
||||
}
|
||||
|
||||
/*
|
||||
* Our "onSubmit" hook: an action execute method.
|
||||
*/
|
||||
public Event calculateAge(RequestContext context) throws Exception {
|
||||
// pull the date from the model
|
||||
BirthDate birthDate = (BirthDate)getFormObject(context);
|
||||
|
||||
// calculate the age (quick & dirty)
|
||||
// in a real application you would delegate to the business layer for
|
||||
// this kind of logic
|
||||
Calendar calBirthDate = new GregorianCalendar();
|
||||
calBirthDate.setTime(birthDate.getDate());
|
||||
Calendar calNow = new GregorianCalendar();
|
||||
|
||||
int ageYears = calNow.get(Calendar.YEAR) - calBirthDate.get(Calendar.YEAR);
|
||||
long ageMonths = calNow.get(Calendar.MONTH) - calBirthDate.get(Calendar.MONTH);
|
||||
long ageDays = calNow.get(Calendar.DAY_OF_MONTH) - calBirthDate.get(Calendar.DAY_OF_MONTH);
|
||||
|
||||
if (ageDays < 0) {
|
||||
ageMonths--;
|
||||
ageDays += calBirthDate.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
if (ageMonths < 0) {
|
||||
ageYears--;
|
||||
ageMonths += 12;
|
||||
}
|
||||
|
||||
// create a nice age string
|
||||
StringBuffer ageStr = new StringBuffer();
|
||||
ageStr.append(ageYears).append(" years, ");
|
||||
ageStr.append(ageMonths).append(" months and ");
|
||||
ageStr.append(ageDays).append(" days");
|
||||
|
||||
// put it in the model for display by the view
|
||||
context.getRequestScope().put(AGE_NAME, ageStr);
|
||||
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2002-2006 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.
|
||||
*/
|
||||
package org.springframework.webflow.samples.birthdate;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.ValidationUtils;
|
||||
import org.springframework.validation.Validator;
|
||||
|
||||
public class BirthDateValidator implements Validator {
|
||||
|
||||
public boolean supports(Class clazz) {
|
||||
return clazz.equals(BirthDate.class);
|
||||
}
|
||||
|
||||
public void validate(Object obj, Errors errors) {
|
||||
BirthDate birthDate = (BirthDate)obj;
|
||||
validateBirthdateForm(birthDate, errors);
|
||||
validateCardForm(birthDate, errors);
|
||||
}
|
||||
|
||||
public void validateBirthdateForm(BirthDate birthDate, Errors errors) {
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "noName", "Please specify your name.");
|
||||
ValidationUtils.rejectIfEmpty(errors, "date", "noDate", "Please specify your birth date.");
|
||||
}
|
||||
|
||||
public void validateCardForm(BirthDate birthDate, Errors errors) {
|
||||
if (birthDate.isSendCard()) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(birthDate.getDate());
|
||||
if (cal.get(Calendar.MONTH) == 11) {
|
||||
errors.reject("tooGoodForCards", "You're born in December--you're too good for a silly card!");
|
||||
}
|
||||
else {
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "emailAddress", "noEmail",
|
||||
"Please specify your email address.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
errors.header=<table>
|
||||
errors.footer=</table>
|
||||
errors.prefix=<tr><td><font color="red">
|
||||
errors.suffix=</font></td></tr>
|
||||
|
||||
noName=Your name is required
|
||||
noDate=Your birth date is required
|
||||
noEmail=Your email address is required
|
||||
typeMismatch.java.util.Date=You entered an invalid date format
|
||||
|
||||
tooGoodForCards=You're born in December--you're too good for a silly card!
|
||||
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
This simple flow demonstrates the use of the FormAction: a multi-action.
|
||||
Notice how all the actions use the same "formAction" bean, which groups
|
||||
all actions executed by this flow in single class.
|
||||
|
||||
This is a simplified alternate definition of the BirthDate flow (see birthdate.xml) that
|
||||
uses view state render actions and transition actions to make the flow definition more compact.
|
||||
-->
|
||||
<flow xmlns="http://www.springframework.org/schema/webflow"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/webflow
|
||||
http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
|
||||
|
||||
<start-state idref="enterBirthdate" />
|
||||
|
||||
<view-state id="enterBirthdate" view="birthdateForm">
|
||||
<render-actions>
|
||||
<action bean="formAction" method="setupForm" />
|
||||
</render-actions>
|
||||
<transition on="submit" to="enterCardInformation">
|
||||
<action bean="formAction" method="bindAndValidate">
|
||||
<attribute name="validatorMethod" value="validateBirthdateForm" />
|
||||
</action>
|
||||
</transition>
|
||||
</view-state>
|
||||
|
||||
<view-state id="enterCardInformation" view="cardForm">
|
||||
<transition on="submit" to="calculateAge">
|
||||
<action bean="formAction" method="bindAndValidate">
|
||||
<attribute name="validatorMethod" value="validateCardForm" />
|
||||
</action>
|
||||
</transition>
|
||||
</view-state>
|
||||
|
||||
<action-state id="calculateAge">
|
||||
<action bean="formAction" method="calculateAge" />
|
||||
<transition on="success" to="displayAge" />
|
||||
</action-state>
|
||||
|
||||
<end-state id="displayAge" view="yourAge" />
|
||||
|
||||
</flow>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow xmlns="http://www.springframework.org/schema/webflow"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/webflow
|
||||
http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
|
||||
|
||||
<start-state idref="enterBirthdate" />
|
||||
|
||||
<!-- Display the first input form view -->
|
||||
<view-state id="enterBirthdate" view="birthdateForm">
|
||||
<!--
|
||||
Prepare to display a new form. Initializes the backing "form object" and installs property
|
||||
editors to format form field values.
|
||||
-->
|
||||
<render-actions>
|
||||
<action bean="formAction" method="setupForm" />
|
||||
</render-actions>
|
||||
<transition on="submit" to="processBirthdateFormSubmit" />
|
||||
</view-state>
|
||||
|
||||
<!-- Bind and validate input data from the form -->
|
||||
<action-state id="processBirthdateFormSubmit">
|
||||
<action bean="formAction" method="bindAndValidate">
|
||||
<attribute name="validatorMethod" value="validateBirthdateForm" />
|
||||
</action>
|
||||
<transition on="success" to="enterCardInformation" />
|
||||
<transition on="error" to="enterBirthdate" />
|
||||
</action-state>
|
||||
|
||||
<!-- Display the next input form view -->
|
||||
<view-state id="enterCardInformation" view="cardForm">
|
||||
<transition on="submit" to="processCardFormSubmit" />
|
||||
</view-state>
|
||||
|
||||
<!-- Bind and validate input data from the form -->
|
||||
<action-state id="processCardFormSubmit">
|
||||
<action bean="formAction" method="bindAndValidate">
|
||||
<attribute name="validatorMethod" value="validateCardForm" />
|
||||
</action>
|
||||
<transition on="success" to="calculateAge" />
|
||||
<transition on="error" to="enterCardInformation" />
|
||||
</action-state>
|
||||
|
||||
<!-- Process the transaction -->
|
||||
<action-state id="calculateAge">
|
||||
<action bean="formAction" method="calculateAge" />
|
||||
<transition on="success" to="displayAge" />
|
||||
</action-state>
|
||||
|
||||
<!-- Display the success view. -->
|
||||
<end-state id="displayAge" view="yourAge" />
|
||||
|
||||
</flow>
|
||||
@@ -0,0 +1,9 @@
|
||||
log4j.rootCategory=WARN, 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.binding=DEBUG
|
||||
@@ -0,0 +1,36 @@
|
||||
<%@ include file="includeTop.jsp" %>
|
||||
|
||||
<div id="content">
|
||||
<div id="insert"><img src="images/webflow-logo.jpg"/></div>
|
||||
<h2>Enter your birth date</h2>
|
||||
<hr>
|
||||
<html:form action="flowAction" method="post">
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<html:errors/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Your name</td>
|
||||
<td>
|
||||
<html:text property="name" size="25" maxlength="30"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Your birth date (DD-MM-YYYY)</td>
|
||||
<td>
|
||||
<html:text property="date" size="10" maxlength="10"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="buttonBar">
|
||||
<html:image src="images/submit.gif" property="_eventId_submit" value="Next"/>
|
||||
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}">
|
||||
</td>
|
||||
</tr>
|
||||
</html:form>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<%@ include file="includeBottom.jsp" %>
|
||||
@@ -0,0 +1,39 @@
|
||||
<%@ include file="includeTop.jsp" %>
|
||||
|
||||
<div id="content">
|
||||
<div id="insert"><img src="images/webflow-logo.jpg"/></div>
|
||||
<h2>Personalized birthday cards</h2>
|
||||
<hr>
|
||||
<html:form action="flowAction" method="post">
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<html:errors/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Would you like a card to be sent on your birthday?</td>
|
||||
<td>
|
||||
<html:checkbox property="sendCard"/>
|
||||
<!-- Checkboxes don't send anything when not selected, so this marker is used to detect
|
||||
a false submission -->
|
||||
<input type="hidden" name="_sendCard" value="marker"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>If so, enter your email address:</td>
|
||||
<td>
|
||||
<html:text property="emailAddress" size="25" maxlength="128"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="buttonBar">
|
||||
<html:image src="images/submit.gif" property="_eventId_submit" value="Calculate Age"/>
|
||||
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}">
|
||||
</td>
|
||||
</tr>
|
||||
</html:form>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<%@ include file="includeBottom.jsp" %>
|
||||
@@ -0,0 +1,5 @@
|
||||
<div id="copyright">
|
||||
<p>© Copyright 2002-2006, <a href="http://www.springframework.org">www.springframework.org</a>, under the terms of the Apache 2.0 software license.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,21 @@
|
||||
<%@ page contentType="text/html" %>
|
||||
<%@ page session="false" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Calculate your Age</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="logo">
|
||||
<img src="images/spring-logo.jpg" alt="Logo">
|
||||
</div>
|
||||
|
||||
<div id="navigation">
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,17 @@
|
||||
<%@ include file="includeTop.jsp" %>
|
||||
|
||||
<div id="content">
|
||||
<div id="insert"><img src="images/webflow-logo.jpg"/></div>
|
||||
<h2>Your age</h2>
|
||||
<hr>
|
||||
<p>
|
||||
${birthDate.name}, you are now <I>${age}</I> old.
|
||||
You were born on <fmt:formatDate value="${birthDate.date}" pattern="dd-MM-yyyy"/>.
|
||||
</p>
|
||||
<hr>
|
||||
<form action="<c:url value="/index.jsp"/>">
|
||||
<INPUT type="submit" value="Home">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<%@ include file="includeBottom.jsp" %>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE struts-config PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
|
||||
"http://struts.apache.org/dtds/struts-config_1_2.dtd">
|
||||
|
||||
<struts-config>
|
||||
|
||||
<form-beans>
|
||||
<!-- A single ActionForm adapter for your entire app is all you need, if you
|
||||
wish to take advantage of Spring's POJO-based data binding and validation. -->
|
||||
<form-bean name="actionForm" type="org.springframework.web.struts.SpringBindingActionForm"/>
|
||||
</form-beans>
|
||||
|
||||
<global-forwards>
|
||||
<forward name="birthdateForm" path="/WEB-INF/jsp/birthdateForm.jsp"/>
|
||||
<forward name="cardForm" path="/WEB-INF/jsp/cardForm.jsp"/>
|
||||
<forward name="yourAge" path="/WEB-INF/jsp/yourAge.jsp"/>
|
||||
</global-forwards>
|
||||
|
||||
<action-mappings>
|
||||
<action path="/home" forward="index.jsp"/>
|
||||
<action path="/flowAction" name="actionForm" scope="request" type="org.springframework.webflow.executor.struts.FlowAction"/>
|
||||
</action-mappings>
|
||||
|
||||
<message-resources parameter="org.springframework.webflow.samples.birthdate.MessageResources"/>
|
||||
|
||||
</struts-config>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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/webflow-config.xml
|
||||
</param-value>
|
||||
</context-param>
|
||||
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>action</servlet-name>
|
||||
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>action</servlet-name>
|
||||
<url-pattern>*.do</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.jsp</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app>
|
||||
@@ -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"
|
||||
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
|
||||
http://www.springframework.org/schema/webflow-config
|
||||
http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd">
|
||||
|
||||
<!-- Launches new flow executions and resumes existing executions. -->
|
||||
<flow:executor id="flowExecutor" registry-ref="flowRegistry"/>
|
||||
|
||||
<!-- Creates the registry of flow definitions for this application -->
|
||||
<flow:registry id="flowRegistry">
|
||||
<flow:location path="/WEB-INF/birthdate.xml"/>
|
||||
<flow:location path="/WEB-INF/birthdate-alternate.xml"/>
|
||||
</flow:registry>
|
||||
|
||||
<!-- Manages the birthdate wizard's "form backing object" -->
|
||||
<bean id="formAction" class="org.springframework.webflow.samples.birthdate.BirthDateFormAction" />
|
||||
|
||||
</beans>
|
||||
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
36
spring-webflow-samples/birthdate/src/main/webapp/index.jsp
Normal file
@@ -0,0 +1,36 @@
|
||||
<%-- make sure we have a session --%>
|
||||
<%@ page session="true" %>
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<DIV align="left">Birth Date - A Spring Web Flow Sample</DIV>
|
||||
|
||||
<HR>
|
||||
|
||||
<DIV align="left">
|
||||
<P>
|
||||
<A href="flowAction.do?_flowId=birthdate">Birth Date</A>
|
||||
</P>
|
||||
|
||||
<P>
|
||||
This sample application demonstrates the use of the FormAction: a multi-action.
|
||||
It also shows you how to use a multi-action to group all actions executed by a flow
|
||||
in a single class.
|
||||
</P>
|
||||
<P>
|
||||
This sample also demonstrates Spring Web Flow's Struts integration.</P>
|
||||
<P>
|
||||
Finally, the sample also uses JSTL in conjunction with flows.
|
||||
</P>
|
||||
</DIV>
|
||||
|
||||
<HR>
|
||||
|
||||
<DIV align="right"></DIV>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
58
spring-webflow-samples/birthdate/src/main/webapp/style.css
Normal file
@@ -0,0 +1,58 @@
|
||||
body {
|
||||
width: 720px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
div#logo {
|
||||
width: 720px;
|
||||
height: 73px;
|
||||
background: #86AEA5;
|
||||
}
|
||||
|
||||
div#navigation {
|
||||
width: 720px;
|
||||
height: 15px;
|
||||
background: #E2F3B8;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div#content {
|
||||
width: 720px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
div#insert {
|
||||
width: 120;
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.buttonBar {
|
||||
height: 1.5em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div#copyright {
|
||||
width: 720px;
|
||||
}
|
||||
|
||||
div#copyright p {
|
||||
text-align: center;
|
||||
font-family: Tahoma, sans-serif;
|
||||
font-size: 75%;
|
||||
color: div#336633;
|
||||
margin-left: 5px;
|
||||
font-weight: bold;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.readOnly {
|
||||
color: rgb(192, 192, 192);
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
log4j.rootCategory=WARN, 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.binding=DEBUG
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2002-2006 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.
|
||||
*/
|
||||
package org.springframework.webflow.samples.birthdate;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.validation.BindException;
|
||||
|
||||
public class BirthdateValidatorTests extends TestCase {
|
||||
|
||||
public void testValidateCardForm() throws Exception {
|
||||
BirthDateValidator validator = new BirthDateValidator();
|
||||
BirthDate birthDate = new BirthDate();
|
||||
birthDate.setName("Keith");
|
||||
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
|
||||
birthDate.setSendCard(true);
|
||||
birthDate.setDate(format.parse("29/12/1977"));
|
||||
BindException errors = new BindException(birthDate, "birthDate");
|
||||
validator.validateCardForm(birthDate, errors);
|
||||
assertEquals(1, errors.getAllErrors().size());
|
||||
}
|
||||
}
|
||||
9
spring-webflow-samples/fileupload/.classpath
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry output="target/test-classes" kind="src" path="src/test/java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.5"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
8
spring-webflow-samples/fileupload/.cvsignore
Normal file
@@ -0,0 +1,8 @@
|
||||
target
|
||||
lib
|
||||
bak
|
||||
build.properties
|
||||
*.log
|
||||
*.jpx.local*
|
||||
*.iws
|
||||
*.tws
|
||||
36
spring-webflow-samples/fileupload/.project
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>swf-phonebook</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</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.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,8 @@
|
||||
#Mon Nov 13 17:29:33 PST 2006
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
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
|
||||
@@ -0,0 +1,3 @@
|
||||
#Mon Nov 13 17:29:33 PST 2006
|
||||
eclipse.preferences.version=1
|
||||
internal.default.compliance=default
|
||||
@@ -0,0 +1,3 @@
|
||||
#Thu Nov 23 20:59:37 CET 2006
|
||||
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER\:\:org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType\:\:jdk1.5.0_08/owners=jst.java\:5.0
|
||||
eclipse.preferences.version=1
|
||||
57
spring-webflow-samples/fileupload/.settings/org.eclipse.wst.common.component
Executable file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="swf-fileupload">
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/standard.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/spring-webmvc.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/spring-webflow.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/spring-web.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/spring-core.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/spring-context.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/spring-binding.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/spring-beans.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/ognl.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/log4j.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/junit.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/jstl.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/commons-logging.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/commons-codec.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/commons-io.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-fileupload/lib/global/commons-fileupload.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="java-output-path" value="target/classes"/>
|
||||
<property name="context-root" value="swf-fileupload"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="jst.java"/>
|
||||
<fixed facet="jst.web"/>
|
||||
<installed facet="jst.java" version="5.0"/>
|
||||
<installed facet="jst.web" version="2.4"/>
|
||||
</faceted-project>
|
||||
@@ -0,0 +1,6 @@
|
||||
#Mon Nov 13 17:29:33 PST 2006
|
||||
DELEGATES_PREFERENCE=delegateValidatorListorg.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator\=org.eclipse.wst.wsdl.validation.internal.eclipse.Validator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator\=org.eclipse.wst.xsd.core.internal.validation.eclipse.Validator;
|
||||
USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.html.internal.validation.HTMLValidator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;org.eclipse.jst.j2ee.internal.web.validation.UIWarValidator;org.eclipse.jst.jsp.core.internal.validation.JSPELValidator;org.eclipse.jst.jsp.core.internal.validation.JSPJavaValidator;org.eclipse.jst.jsp.core.internal.validation.JSPDirectiveValidator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;
|
||||
USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.html.internal.validation.HTMLValidator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;org.eclipse.jst.j2ee.internal.web.validation.UIWarValidator;org.eclipse.jst.jsp.core.internal.validation.JSPELValidator;org.eclipse.jst.jsp.core.internal.validation.JSPJavaValidator;org.eclipse.jst.jsp.core.internal.validation.JSPDirectiveValidator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;
|
||||
USER_PREFERENCE=overrideGlobalPreferencesfalse
|
||||
eclipse.preferences.version=1
|
||||
8
spring-webflow-samples/fileupload/.springBeans
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beansProjectDescription>
|
||||
<configs>
|
||||
<config>src/main/webapp/WEB-INF/fileupload-servlet.xml</config>
|
||||
</configs>
|
||||
<configSets>
|
||||
</configSets>
|
||||
</beansProjectDescription>
|
||||
16
spring-webflow-samples/fileupload/build.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project name="swf-fileupload" default="dist">
|
||||
|
||||
<property file="build.properties"/>
|
||||
<property file="project.properties"/>
|
||||
<property file="${common.build.dir}/build.properties"/>
|
||||
<property file="${common.build.dir}/project.properties"/>
|
||||
<property file="${user.home}/build.properties"/>
|
||||
|
||||
<property name="build.web" value="true"/>
|
||||
|
||||
<import file="${common.build.dir}/common-targets.xml"/>
|
||||
<import file="${common.build.dir}/tomcat-targets.xml"/>
|
||||
|
||||
</project>
|
||||
22
spring-webflow-samples/fileupload/ivy.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<ivy-module version="1.1">
|
||||
|
||||
<info organisation="org.springframework" module="swf-fileupload"/>
|
||||
|
||||
<configurations>
|
||||
<conf name="default" extends="global"/>
|
||||
<conf name="global" visibility="private"/>
|
||||
<conf name="buildtime" visibility="private"/>
|
||||
<conf name="test" visibility="private"/>
|
||||
</configurations>
|
||||
|
||||
<dependencies defaultconf="global->default">
|
||||
<!-- global dependencies -->
|
||||
<dependency org="log4j" name="log4j" rev="1.2.13"/>
|
||||
<dependency org="commons-fileupload" name="commons-fileupload" rev="1.1.1"/>
|
||||
<dependency org="commons-io" name="commons-io" rev="1.2"/>
|
||||
<dependency org="taglibs" name="standard" rev="1.1.2"/>
|
||||
<dependency org="jstl" name="jstl" rev="1.1.2"/>
|
||||
<dependency org="org.springframework" name="spring-webflow" rev="latest.integration"/>
|
||||
</dependencies>
|
||||
|
||||
</ivy-module>
|
||||
10
spring-webflow-samples/fileupload/project.properties
Normal file
@@ -0,0 +1,10 @@
|
||||
# properties defined in this file are overridable by a local build.properties in this project dir
|
||||
|
||||
# The location of the common build system
|
||||
common.build.dir=${basedir}/../../common-build
|
||||
|
||||
javac.source=1.3
|
||||
javac.target=1.3
|
||||
|
||||
# Do not publish built artifacts to the integration repository
|
||||
do.publish=false
|
||||
33
spring-webflow-samples/fileupload/src/etc/filter.properties
Normal file
@@ -0,0 +1,33 @@
|
||||
# $Header$
|
||||
|
||||
# Contains filterable project settings. Setting placeholders in filterable project text
|
||||
# files will be replaced with these values when the 'statics' build target is run.
|
||||
#
|
||||
# You may add static settings directly to this source file in the format:
|
||||
# setting=value e.g MY_SETTING=myvalue
|
||||
# This is appropriate usage if you know the setting value will never change.
|
||||
#
|
||||
# At build time this source file is copied to the ${target.dir} where additional
|
||||
# dynamic settings may be appended using the <propertyfile> task. Use this approach
|
||||
# when a setting value depends on the build or the local user's environment.
|
||||
#
|
||||
# An example of this approach is shown below:
|
||||
#
|
||||
# build.xml
|
||||
# <target name="build.prepare" depends="common-targets.build.prepare">
|
||||
# <!-- Append additional local settings that are applicable to this project -->
|
||||
# <propertyfile file="${target.filter.file}">
|
||||
# <!-- key=the name of the setting
|
||||
# value=the property in your build.properties file that has the local setting value -->
|
||||
# <entry key="MY_LOCAL_SETTING" value="${my.local.setting}" />
|
||||
# </propertyfile>
|
||||
# </target>
|
||||
#
|
||||
# This allows for dynamic replacement values that are sourced from local properties files to facilitate
|
||||
# local user settings.
|
||||
#
|
||||
# To refer to filterable settings within project source files like config files, JSPs, or
|
||||
# other text files use the standard ant placeholder format:
|
||||
# @SETTING_NAME@ e.g, @MY_SETTING@ and @MY_LOCAL_SETTING@
|
||||
#
|
||||
# Your settings:
|
||||
@@ -0,0 +1,15 @@
|
||||
log4j.rootCategory=DEBUG, stdout, logfile
|
||||
|
||||
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
|
||||
|
||||
log4j.appender.logfile=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.logfile.File=@TEST_RESULTS_DIR@/@PROJECT_NAME@.log
|
||||
log4j.appender.logfile.MaxFileSize=512KB
|
||||
|
||||
# Keep three backup files
|
||||
log4j.appender.logfile.MaxBackupIndex=3
|
||||
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
|
||||
#Pattern to output : date priority [category] - <message>line_separator
|
||||
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - <%m>%n
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2002-2006 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.
|
||||
*/
|
||||
package org.springframework.webflow.samples.fileupload;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.webflow.action.AbstractAction;
|
||||
import org.springframework.webflow.execution.Event;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
|
||||
public class FileUploadAction extends AbstractAction {
|
||||
|
||||
protected Event doExecute(RequestContext context) throws Exception {
|
||||
MultipartFile file = context.getRequestParameters().getRequiredMultipartFile("file");
|
||||
if (file.getSize() > 0) {
|
||||
// data was uploaded
|
||||
context.getFlashScope().put("file", new String(file.getBytes()));
|
||||
return success();
|
||||
}
|
||||
else {
|
||||
return error();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
log4j.rootCategory=WARN, 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.binding=DEBUG
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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
|
||||
http://www.springframework.org/schema/webflow-config
|
||||
http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd">
|
||||
|
||||
<!--
|
||||
Exposes web flows for execution at a single request URL.
|
||||
The id of a flow to launch should be passed in by clients using
|
||||
the "_flowId" request parameter:
|
||||
e.g. /admin.htm?_flowId=fileupload
|
||||
-->
|
||||
<bean name="/admin.htm" class="org.springframework.webflow.executor.mvc.FlowController">
|
||||
<property name="flowExecutor" ref="flowExecutor" />
|
||||
</bean>
|
||||
|
||||
<!-- Launches new flow executions and resumes existing executions. -->
|
||||
<flow:executor id="flowExecutor" registry-ref="flowRegistry" repository-type="singlekey"/>
|
||||
|
||||
<!-- Creates the registry of flow definitions for this application -->
|
||||
<flow:registry id="flowRegistry">
|
||||
<flow:location path="/WEB-INF/fileupload.xml" />
|
||||
</flow:registry>
|
||||
|
||||
<!--
|
||||
Support for multipart requests using commons file upload
|
||||
Make sure you have the commons-fileupload.jar in your classpath
|
||||
-->
|
||||
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
||||
<!-- Limit uploads to small (5KB) files for this sample -->
|
||||
<property name="maxUploadSize" value="5120" />
|
||||
</bean>
|
||||
|
||||
<!-- Resolves flow view names to .jsp templates -->
|
||||
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<property name="prefix" value="/WEB-INF/jsp/" />
|
||||
<property name="suffix" value=".jsp" />
|
||||
</bean>
|
||||
|
||||
<bean id="uploadAction" class="org.springframework.webflow.samples.fileupload.FileUploadAction" />
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow xmlns="http://www.springframework.org/schema/webflow"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/webflow
|
||||
http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
|
||||
|
||||
<start-state idref="selectFile"/>
|
||||
|
||||
<view-state id="selectFile" view="fileForm">
|
||||
<transition on="submit" to="uploadFile"/>
|
||||
</view-state>
|
||||
|
||||
<action-state id="uploadFile">
|
||||
<action bean="uploadAction" method="uploadFile"/>
|
||||
<transition on="success" to="selectFile">
|
||||
<set attribute="fileUploaded" scope="flash" value="true"/>
|
||||
</transition>
|
||||
<transition on="error" to="selectFile"/>
|
||||
</action-state>
|
||||
|
||||
</flow>
|
||||
@@ -0,0 +1,38 @@
|
||||
<%@ include file="includeTop.jsp" %>
|
||||
|
||||
<div id="content">
|
||||
<div id="insert">
|
||||
<img src="images/webflow-logo.jpg"/>
|
||||
</div>
|
||||
<h2>Select the file to upload</h2>
|
||||
<hr>
|
||||
<table>
|
||||
<c:if test="${fileUploaded}">
|
||||
<p>File uploaded succesfully.</p>
|
||||
<c:if test="${!empty(file)}">
|
||||
<pre style="border: solid 1px;">${file}</pre>
|
||||
</c:if>
|
||||
</c:if>
|
||||
<form name="submitForm" method="post" enctype="multipart/form-data">
|
||||
<tr>
|
||||
<td>
|
||||
File:
|
||||
</td>
|
||||
<td>
|
||||
<input type="file" name="file">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="buttonBar">
|
||||
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}">
|
||||
<input type="submit" class="button" name="_eventId_submit" value="Upload">
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<%@ include file="includeBottom.jsp" %>
|
||||
@@ -0,0 +1,5 @@
|
||||
<div id="copyright">
|
||||
<p>© Copyright 2002-2006, <a href="http://www.springframework.org">www.springframework.org</a>, under the terms of the Apache 2.0 software license.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,21 @@
|
||||
<%@ page contentType="text/html" %>
|
||||
<%@ page session="false" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Upload a file</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="logo">
|
||||
<img src="images/spring-logo.jpg" alt="Logo">
|
||||
</div>
|
||||
|
||||
<div id="navigation">
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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">
|
||||
|
||||
<servlet>
|
||||
<servlet-name>fileupload</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>fileupload</servlet-name>
|
||||
<url-pattern>*.htm</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.jsp</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app>
|
||||
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
33
spring-webflow-samples/fileupload/src/main/webapp/index.jsp
Normal file
@@ -0,0 +1,33 @@
|
||||
<%@ page session="true" %> <%-- make sure we have a session --%>
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<DIV align="left">File Upload - A Spring Web Flow Sample</DIV>
|
||||
|
||||
<HR>
|
||||
|
||||
<DIV align="left">
|
||||
<P>
|
||||
<A href="admin.htm?_flowId=fileupload">File Upload</A>
|
||||
</P>
|
||||
|
||||
<P>
|
||||
This sample application illustrates dealing with file uploads in a
|
||||
Spring web flow based application. Consult the
|
||||
<A href="http://www.springframework.org/docs/reference/mvc.html#mvc-multipart">Spring reference documentation</A>
|
||||
for more information about the techniques used here.<BR>
|
||||
This implementation uses <A href="http://jakarta.apache.org/commons/fileupload/">Jakarta commons FileUpload</A>
|
||||
to process multipart requests.
|
||||
</P>
|
||||
</DIV>
|
||||
|
||||
<HR>
|
||||
|
||||
<DIV align="right"></DIV>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
58
spring-webflow-samples/fileupload/src/main/webapp/style.css
Normal file
@@ -0,0 +1,58 @@
|
||||
body {
|
||||
width: 720px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
div#logo {
|
||||
width: 720px;
|
||||
height: 73px;
|
||||
background: #86AEA5;
|
||||
}
|
||||
|
||||
div#navigation {
|
||||
width: 720px;
|
||||
height: 15px;
|
||||
background: #E2F3B8;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div#content {
|
||||
width: 720px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
div#insert {
|
||||
width: 120;
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.buttonBar {
|
||||
height: 1.5em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div#copyright {
|
||||
width: 720px;
|
||||
}
|
||||
|
||||
div#copyright p {
|
||||
text-align: center;
|
||||
font-family: Tahoma, sans-serif;
|
||||
font-size: 75%;
|
||||
color: div#336633;
|
||||
margin-left: 5px;
|
||||
font-weight: bold;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.readOnly {
|
||||
color: rgb(192, 192, 192);
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
9
spring-webflow-samples/flowlauncher/.classpath
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry output="target/test-classes" kind="src" path="src/test/java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.5"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
8
spring-webflow-samples/flowlauncher/.cvsignore
Normal file
@@ -0,0 +1,8 @@
|
||||
target
|
||||
lib
|
||||
bak
|
||||
build.properties
|
||||
*.log
|
||||
*.jpx.local*
|
||||
*.iws
|
||||
*.tws
|
||||
36
spring-webflow-samples/flowlauncher/.project
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>swf-flowlauncher</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</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.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,8 @@
|
||||
#Mon Nov 13 17:29:33 PST 2006
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
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
|
||||
@@ -0,0 +1,3 @@
|
||||
#Mon Nov 13 17:29:33 PST 2006
|
||||
eclipse.preferences.version=1
|
||||
internal.default.compliance=default
|
||||
@@ -0,0 +1,4 @@
|
||||
#Mon Nov 13 17:23:47 PST 2006
|
||||
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER/owners=jst.java\:5.0
|
||||
classpath.helper/org.eclipse.jst.server.core.container\:\:org.eclipse.jst.server.tomcat.runtimeTarget\:\:Apache\ Tomcat\ v5.5/owners=jst.web\:2.4
|
||||
eclipse.preferences.version=1
|
||||
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="swf-flowlauncher">
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-flowlauncher/lib/global/standard.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-flowlauncher/lib/global/spring-webmvc.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-flowlauncher/lib/global/spring-webflow.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-flowlauncher/lib/global/spring-web.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-flowlauncher/lib/global/spring-core.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-flowlauncher/lib/global/spring-context.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-flowlauncher/lib/global/spring-binding.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-flowlauncher/lib/global/spring-beans.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-flowlauncher/lib/global/ognl.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-flowlauncher/lib/global/log4j.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-flowlauncher/lib/global/junit.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-flowlauncher/lib/global/jstl.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-flowlauncher/lib/global/commons-logging.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-flowlauncher/lib/global/commons-codec.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="java-output-path" value="target/classes"/>
|
||||
<property name="context-root" value="swf-flowlauncher"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="jst.web"/>
|
||||
<fixed facet="jst.java"/>
|
||||
<installed facet="jst.web" version="2.4"/>
|
||||
<installed facet="jst.java" version="5.0"/>
|
||||
</faceted-project>
|
||||
@@ -0,0 +1,6 @@
|
||||
#Mon Nov 13 17:29:33 PST 2006
|
||||
DELEGATES_PREFERENCE=delegateValidatorListorg.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator\=org.eclipse.wst.wsdl.validation.internal.eclipse.Validator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator\=org.eclipse.wst.xsd.core.internal.validation.eclipse.Validator;
|
||||
USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.html.internal.validation.HTMLValidator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;org.eclipse.jst.j2ee.internal.web.validation.UIWarValidator;org.eclipse.jst.jsp.core.internal.validation.JSPELValidator;org.eclipse.jst.jsp.core.internal.validation.JSPJavaValidator;org.eclipse.jst.jsp.core.internal.validation.JSPDirectiveValidator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;
|
||||
USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.html.internal.validation.HTMLValidator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;org.eclipse.jst.j2ee.internal.web.validation.UIWarValidator;org.eclipse.jst.jsp.core.internal.validation.JSPELValidator;org.eclipse.jst.jsp.core.internal.validation.JSPJavaValidator;org.eclipse.jst.jsp.core.internal.validation.JSPDirectiveValidator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;
|
||||
USER_PREFERENCE=overrideGlobalPreferencesfalse
|
||||
eclipse.preferences.version=1
|
||||
8
spring-webflow-samples/flowlauncher/.springBeans
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beansProjectDescription>
|
||||
<configs>
|
||||
<config>src/main/webapp/WEB-INF/flowlauncher-servlet.xml</config>
|
||||
</configs>
|
||||
<configSets>
|
||||
</configSets>
|
||||
</beansProjectDescription>
|
||||
15
spring-webflow-samples/flowlauncher/build.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project name="swf-flowlauncher" default="dist">
|
||||
|
||||
<property file="build.properties"/>
|
||||
<property file="project.properties"/>
|
||||
<property file="${common.build.dir}/build.properties"/>
|
||||
<property file="${common.build.dir}/project.properties"/>
|
||||
<property file="${user.home}/build.properties"/>
|
||||
|
||||
<property name="build.web" value="true"/>
|
||||
|
||||
<import file="${common.build.dir}/common-targets.xml"/>
|
||||
<import file="${common.build.dir}/tomcat-targets.xml"/>
|
||||
</project>
|
||||
20
spring-webflow-samples/flowlauncher/ivy.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<ivy-module version="1.1">
|
||||
|
||||
<info organisation="org.springframework" module="swf-flowlauncher"/>
|
||||
|
||||
<configurations>
|
||||
<conf name="default" extends="global"/>
|
||||
<conf name="global" visibility="private"/>
|
||||
<conf name="buildtime" visibility="private"/>
|
||||
<conf name="test" visibility="private"/>
|
||||
</configurations>
|
||||
|
||||
<dependencies defaultconf="global->default">
|
||||
<!-- global dependencies -->
|
||||
<dependency org="log4j" name="log4j" rev="1.2.13"/>
|
||||
<dependency org="taglibs" name="standard" rev="1.1.2"/>
|
||||
<dependency org="jstl" name="jstl" rev="1.1.2"/>
|
||||
<dependency org="org.springframework" name="spring-webflow" rev="latest.integration"/>
|
||||
</dependencies>
|
||||
|
||||
</ivy-module>
|
||||
10
spring-webflow-samples/flowlauncher/project.properties
Normal file
@@ -0,0 +1,10 @@
|
||||
# properties defined in this file are overridable by a local build.properties in this project dir
|
||||
|
||||
# The location of the common build system
|
||||
common.build.dir=${basedir}/../../common-build
|
||||
|
||||
javac.source=1.3
|
||||
javac.target=1.3
|
||||
|
||||
# Do not publish built artifacts to the integration repository
|
||||
do.publish=false
|
||||
@@ -0,0 +1,33 @@
|
||||
# $Header$
|
||||
|
||||
# Contains filterable project settings. Setting placeholders in filterable project text
|
||||
# files will be replaced with these values when the 'statics' build target is run.
|
||||
#
|
||||
# You may add static settings directly to this source file in the format:
|
||||
# setting=value e.g MY_SETTING=myvalue
|
||||
# This is appropriate usage if you know the setting value will never change.
|
||||
#
|
||||
# At build time this source file is copied to the ${target.dir} where additional
|
||||
# dynamic settings may be appended using the <propertyfile> task. Use this approach
|
||||
# when a setting value depends on the build or the local user's environment.
|
||||
#
|
||||
# An example of this approach is shown below:
|
||||
#
|
||||
# build.xml
|
||||
# <target name="build.prepare" depends="common-targets.build.prepare">
|
||||
# <!-- Append additional local settings that are applicable to this project -->
|
||||
# <propertyfile file="${target.filter.file}">
|
||||
# <!-- key=the name of the setting
|
||||
# value=the property in your build.properties file that has the local setting value -->
|
||||
# <entry key="MY_LOCAL_SETTING" value="${my.local.setting}" />
|
||||
# </propertyfile>
|
||||
# </target>
|
||||
#
|
||||
# This allows for dynamic replacement values that are sourced from local properties files to facilitate
|
||||
# local user settings.
|
||||
#
|
||||
# To refer to filterable settings within project source files like config files, JSPs, or
|
||||
# other text files use the standard ant placeholder format:
|
||||
# @SETTING_NAME@ e.g, @MY_SETTING@ and @MY_LOCAL_SETTING@
|
||||
#
|
||||
# Your settings:
|
||||
@@ -0,0 +1,15 @@
|
||||
log4j.rootCategory=DEBUG, stdout, logfile
|
||||
|
||||
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
|
||||
|
||||
log4j.appender.logfile=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.logfile.File=@TEST_RESULTS_DIR@/@PROJECT_NAME@.log
|
||||
log4j.appender.logfile.MaxFileSize=512KB
|
||||
|
||||
# Keep three backup files
|
||||
log4j.appender.logfile.MaxBackupIndex=3
|
||||
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
|
||||
#Pattern to output : date priority [category] - <message>line_separator
|
||||
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - <%m>%n
|
||||
@@ -0,0 +1,9 @@
|
||||
log4j.rootCategory=WARN, 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.binding=DEBUG
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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
|
||||
http://www.springframework.org/schema/webflow-config
|
||||
http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd">
|
||||
|
||||
<!--
|
||||
Exposes web flows for execution at a single request URL.
|
||||
The id of a flow to launch should be passed in by clients using
|
||||
the "_flowId" request parameter:
|
||||
e.g. /flowController.htm?_flowId=sampleA
|
||||
-->
|
||||
<bean name="/flowController.htm" class="org.springframework.webflow.executor.mvc.FlowController">
|
||||
<property name="flowExecutor" ref="flowExecutor" />
|
||||
</bean>
|
||||
|
||||
<!-- Launches new flow executions and resumes existing executions. -->
|
||||
<flow:executor id="flowExecutor" registry-ref="flowRegistry"/>
|
||||
|
||||
<!-- Creates the registry of flow definitions for this application -->
|
||||
<flow:registry id="flowRegistry">
|
||||
<flow:location path="/WEB-INF/sampleA.xml" />
|
||||
<flow:location path="/WEB-INF/sampleB.xml" />
|
||||
</flow:registry>
|
||||
|
||||
<!-- Resolves flow view names to .jsp templates -->
|
||||
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<property name="prefix" value="/WEB-INF/jsp/" />
|
||||
<property name="suffix" value=".jsp" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,110 @@
|
||||
<%@ include file="includeTop.jsp" %>
|
||||
|
||||
<div id="content">
|
||||
Sample A Flow
|
||||
<hr>
|
||||
Flow input was: ${input}<br>
|
||||
<br>
|
||||
From Sample A you may terminate Sample A and launch Sample B from an end state of Sample A.
|
||||
You may also pass Sample B input. This can be done using:
|
||||
<ul>
|
||||
<table>
|
||||
<tr>
|
||||
<td>an anchor:</td>
|
||||
<td>
|
||||
<a href="<c:url value="/flowController.htm?_flowExecutionKey=${flowExecutionKey}&_eventId=end-A-and-launch-B&input=someInputForSampleB"/>">
|
||||
End Sample A and Launch Sample B
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">or a form:</td>
|
||||
<td>
|
||||
<table>
|
||||
<form action="flowController.htm" method="post">
|
||||
<tr>
|
||||
<td>
|
||||
<input type="text" name="input" value="someInputForSampleB">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="buttonBar">
|
||||
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}">
|
||||
<input type="submit" name="_eventId_end-A-and-launch-B" value="End Sample A and Launch Sample B">
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ul>
|
||||
Alternatively, you may spawn Sample B as a sub flow of Sample A. In this case a flow
|
||||
attribute mapper maps the input stored in the FlowScope of Sample A down to the spawning subflow
|
||||
Here again you have the option of using:
|
||||
<ul>
|
||||
<table>
|
||||
<tr>
|
||||
<td>an anchor:</td>
|
||||
<td>
|
||||
<a href="<c:url value="/flowController.htm?_flowExecutionKey=${flowExecutionKey}&_eventId=launch-B-as-subflow"/>">
|
||||
Launch Sample B as a Sub Flow
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">or a form:</td>
|
||||
<td>
|
||||
<table>
|
||||
<form action="flowController.htm" method="post">
|
||||
<tr>
|
||||
<td class="buttonBar">
|
||||
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}">
|
||||
<input type="submit" name="_eventId_launch-B-as-subflow" value="Launch Sample B as a Sub Flow">
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ul>
|
||||
Yet another option is to launch Sample B as a top-level flow without involving Sample A as:
|
||||
<ul>
|
||||
<table>
|
||||
<tr>
|
||||
<td>an anchor:</td>
|
||||
<td>
|
||||
<a href="<c:url value="/flowController.htm?_flowId=sampleB&input=someInputForSampleB"/>">
|
||||
Launch Sample B
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">or a form:</td>
|
||||
<td>
|
||||
<table>
|
||||
<form action="flowController.htm" method="post">
|
||||
<tr>
|
||||
<td>
|
||||
<input type="text" name="input" value="someInputForSampleB">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="buttonBar">
|
||||
<input type="hidden" name="_flowId" value="sampleB">
|
||||
<input type="submit" value="Launch Sample B">
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ul>
|
||||
<form action="<c:url value="/index.html"/>">
|
||||
<INPUT type="submit" value="Home">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<%@ include file="includeBottom.jsp" %>
|
||||
@@ -0,0 +1,45 @@
|
||||
<%@ include file="includeTop.jsp" %>
|
||||
|
||||
<div id="content">
|
||||
Sample B Flow
|
||||
<hr>
|
||||
Flow input was: ${input}<BR>
|
||||
<c:if test="${!flowExecutionContext.activeSession.root}">
|
||||
<br>
|
||||
Sample B is now running as a sub flow within Sample A. This means we can end Sample B and
|
||||
return to the parent flow. We can do this using either:
|
||||
<ul>
|
||||
<table>
|
||||
<tr>
|
||||
<td>an anchor:</td>
|
||||
<td>
|
||||
<a href="<c:url value="/flowController.htm?_flowExecutionKey=${flowExecutionKey}&_eventId=end"/>">
|
||||
End Sample B
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">or a form:</td>
|
||||
<td>
|
||||
<table>
|
||||
<form action="flowController.htm" method="post">
|
||||
<tr>
|
||||
<td class="buttonBar">
|
||||
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}">
|
||||
<input type="submit" name="_eventId_end" value="End Sample B">
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ul>
|
||||
</c:if>
|
||||
<hr>
|
||||
<form action="<c:url value="/index.html"/>">
|
||||
<input type="submit" value="Home">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<%@ include file="includeBottom.jsp" %>
|
||||
@@ -0,0 +1,5 @@
|
||||
<div id="copyright">
|
||||
<p>© Copyright 2002-2006, <a href="http://www.springframework.org">www.springframework.org</a>, under the terms of the Apache 2.0 software license.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,21 @@
|
||||
<%@ page contentType="text/html" %>
|
||||
<%@ page session="false" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Launch a flow</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="logo">
|
||||
<img src="images/spring-logo.jpg" alt="Logo">
|
||||
</div>
|
||||
|
||||
<div id="navigation">
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow xmlns="http://www.springframework.org/schema/webflow"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/webflow
|
||||
http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
|
||||
|
||||
<input-mapper>
|
||||
<mapping source="input" target="flowScope.input" />
|
||||
</input-mapper>
|
||||
|
||||
<start-state idref="aPage" />
|
||||
|
||||
<view-state id="aPage" view="aPage">
|
||||
<transition on="launch-B-as-subflow" to="launchB" />
|
||||
<transition on="end-A-and-launch-B" to="endAndLaunchB" />
|
||||
</view-state>
|
||||
|
||||
<subflow-state id="launchB" flow="sampleB">
|
||||
<attribute-mapper>
|
||||
<input-mapper>
|
||||
<mapping source="requestParameters.input" target="input" />
|
||||
</input-mapper>
|
||||
</attribute-mapper>
|
||||
<transition on="end" to="aPage" />
|
||||
</subflow-state>
|
||||
|
||||
<end-state id="endAndLaunchB" view="flowRedirect:sampleB?input=${requestParameters.input}" />
|
||||
|
||||
</flow>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow xmlns="http://www.springframework.org/schema/webflow"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/webflow
|
||||
http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
|
||||
|
||||
<input-mapper>
|
||||
<mapping source="input" target="flowScope.input" />
|
||||
</input-mapper>
|
||||
|
||||
<start-state idref="bPage" />
|
||||
|
||||
<view-state id="bPage" view="bPage">
|
||||
<transition on="end" to="end" />
|
||||
</view-state>
|
||||
|
||||
<end-state id="end" />
|
||||
|
||||
</flow>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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">
|
||||
|
||||
<servlet>
|
||||
<servlet-name>flowlauncher</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>flowlauncher</servlet-name>
|
||||
<url-pattern>*.htm</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app>
|
||||
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,72 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<DIV align="left">Flow Launcher - A Spring Web Flow Sample</DIV>
|
||||
<HR>
|
||||
<DIV align="left">
|
||||
<P>
|
||||
This sample application demonstrates different ways of launching flows with
|
||||
input parameters.
|
||||
</P>
|
||||
<P>
|
||||
You can launch the Sample A flow as a top-level flow and pass it input using
|
||||
request parameters. This can be done using
|
||||
<table>
|
||||
<tr>
|
||||
<td>an anchor:</td>
|
||||
<td><A href="flowController.htm?_flowId=sampleA&input=someInputForSampleA">Start Sample A</A></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">or a form:</td>
|
||||
<td>
|
||||
<table>
|
||||
<form action="flowController.htm" method="post">
|
||||
<tr>
|
||||
<td><INPUT type="text" name="input" value="someInputForSampleA"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="buttonBar">
|
||||
<INPUT type="hidden" name="_flowId" value="sampleA">
|
||||
<INPUT type="submit" value="Start Sample A">
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</P>
|
||||
<P>
|
||||
The same is true for Sample B:
|
||||
<table>
|
||||
<tr>
|
||||
<td>an anchor:</td>
|
||||
<td><A href="flowController.htm?_flowId=sampleB&input=someInputForSampleB">Start Sample B</A></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">or a form:</td>
|
||||
<td>
|
||||
<table>
|
||||
<form action="flowController.htm" method="post">
|
||||
<tr>
|
||||
<td><INPUT type="text" name="input" value="someInputForSampleB"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="buttonBar">
|
||||
<INPUT type="hidden" name="_flowId" value="sampleB">
|
||||
<INPUT type="submit" value="Start Sample B">
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</P>
|
||||
</DIV>
|
||||
<HR>
|
||||
<DIV align="right"></DIV>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -0,0 +1,58 @@
|
||||
body {
|
||||
width: 720px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
div#logo {
|
||||
width: 720px;
|
||||
height: 73px;
|
||||
background: #86AEA5;
|
||||
}
|
||||
|
||||
div#navigation {
|
||||
width: 720px;
|
||||
height: 15px;
|
||||
background: #E2F3B8;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div#content {
|
||||
width: 720px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
div#insert {
|
||||
width: 120;
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.buttonBar {
|
||||
height: 1.5em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div#copyright {
|
||||
width: 720px;
|
||||
}
|
||||
|
||||
div#copyright p {
|
||||
text-align: center;
|
||||
font-family: Tahoma, sans-serif;
|
||||
font-size: 75%;
|
||||
color: div#336633;
|
||||
margin-left: 5px;
|
||||
font-weight: bold;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.readOnly {
|
||||
color: rgb(192, 192, 192);
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
9
spring-webflow-samples/itemlist/.classpath
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry output="target/test-classes" kind="src" path="src/test/java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.5"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
8
spring-webflow-samples/itemlist/.cvsignore
Normal file
@@ -0,0 +1,8 @@
|
||||
target
|
||||
lib
|
||||
bak
|
||||
build.properties
|
||||
*.log
|
||||
*.jpx.local*
|
||||
*.iws
|
||||
*.tws
|
||||
36
spring-webflow-samples/itemlist/.project
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>swf-itemlist</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</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.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,8 @@
|
||||
#Mon Nov 13 17:29:33 PST 2006
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
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
|
||||
@@ -0,0 +1,3 @@
|
||||
#Mon Nov 13 17:29:33 PST 2006
|
||||
eclipse.preferences.version=1
|
||||
internal.default.compliance=default
|
||||
@@ -0,0 +1,4 @@
|
||||
#Mon Nov 13 17:23:47 PST 2006
|
||||
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER/owners=jst.java\:5.0
|
||||
classpath.helper/org.eclipse.jst.server.core.container\:\:org.eclipse.jst.server.tomcat.runtimeTarget\:\:Apache\ Tomcat\ v5.5/owners=jst.web\:2.4
|
||||
eclipse.preferences.version=1
|
||||
51
spring-webflow-samples/itemlist/.settings/org.eclipse.wst.common.component
Executable file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="swf-itemlist">
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-itemlist/lib/global/standard.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-itemlist/lib/global/spring-webmvc.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-itemlist/lib/global/spring-webflow.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-itemlist/lib/global/spring-web.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-itemlist/lib/global/spring-core.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-itemlist/lib/global/spring-context.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-itemlist/lib/global/spring-binding.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-itemlist/lib/global/spring-beans.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-itemlist/lib/global/ognl.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-itemlist/lib/global/log4j.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-itemlist/lib/global/junit.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-itemlist/lib/global/jstl.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-itemlist/lib/global/commons-logging.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/swf-itemlist/lib/global/commons-codec.jar">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="java-output-path" value="target/classes"/>
|
||||
<property name="context-root" value="swf-itemlist"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="jst.web"/>
|
||||
<fixed facet="jst.java"/>
|
||||
<installed facet="jst.web" version="2.4"/>
|
||||
<installed facet="jst.java" version="5.0"/>
|
||||
</faceted-project>
|
||||