Spring Web Flow 简单实现


1、构建maven结构(略)

http://blog.csdn.net/bestcxx/article/details/54589039

本篇配置文件没有分离:Spring Web Flow 简单实现-自定义配置文件位置


2、Spring Web Flow Maven依赖

  org.springframework.webflowspring-webflow2.4.5.RELEASE

3、pom.xml 全部内容

4.0.0com.stu.bestcxx.stuspringwebflow0.0.1-SNAPSHOTwarSpring Web Flow StudySpring Web Flow Study    UTF-8      4.3.0.RELEASE  2.5.4    mvc        org.apache.maven.plugins  maven-compiler-plugin  2.3.2    1.7  1.7  ${project.build.sourceEncoding}  springwebflow        org.mortbay.jetty  maven-jetty-plugin  6.1.26        ${project.build.outputDirectory}          0        8085                    junit  junit  4.12  test          org.springframework  spring-webmvc  ${springframework.version}      org.springframework  spring-core  ${springframework.version}      org.springframework  spring-context  ${springframework.version}    org.springframework  spring-context-support  ${springframework.version}      org.springframework  spring-beans  ${springframework.version}      org.springframework  spring-tx  ${springframework.version}      org.springframework  spring-orm  ${springframework.version}      org.springframework  spring-aop  ${springframework.version}      org.springframework  spring-test  ${springframework.version}    org.springframework.webflowspring-webflow2.4.5.RELEASE    org.springframework  spring-web  4.3.0.RELEASE      org.aspectj  aspectjweaver  1.7.1      org.aspectj  aspectjrt  1.8.9      aopalliance  aopalliance  1.0        javax.servlet  javax.servlet-api  3.0.1              javax.servlet    jstl    1.2    runtime      com.fasterxml.jackson.corejackson-core${jackson.version}com.fasterxml.jackson.corejackson-databind${jackson.version}commons-langcommons-lang2.6org.apache.commonscommons-lang33.4org.mybatismybatis3.4.2org.mybatismybatis-spring1.3.1commons-dbcpcommons-dbcp1.4mysqlmysql-connector-java5.1.21org.apache.logging.log4jlog4j-core2.7org.apache.logging.log4jlog4j-api2.7commons-poolcommons-pool1.6org.quartz-schedulerquartz2.2.1  com.alibaba  druid  1.0.18   commons-iocommons-io2.5commons-fileuploadcommons-fileupload1.3com.alibabadubbo2.5.3  org.apache.zookeeper  zookeeper  3.4.6      com.github.sgroschupf  zkclient  0.1   org.apache.activemqactivemq-all5.14.5  org.springframework  spring-jms  4.1.6.RELEASE  compile  javax.jmsjms1.1javax.validationvalidation-api1.1.0.Finalorg.hibernatehibernate-validator5.4.1.Final            mynexusnamehttp://localhost:8081/nexus/content/repositories/releases/mynexusnamehttp://localhost:8081/nexus/content/repositories/snapshots/


4、Jsp 页面


index.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>




Insert title here

Spring Web Flow 例子

入口的href为 web flow 配置文件的id

Spring Web Flow 为视图的用户提供了一个 flowExecutionUrl 变量,它包含了流程的 URL。该链接将一个_eventId 参数关联到 URL 上,以便返回到 Web 流程时触发 finishaed 事件。这个事件将会使流程到达结束状态。

入口



位于 webapp/WEB-INF/flows下的finish.jsp和show.jsp


finish.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>




Insert title here




Spring Web Flow 例子

Spring Web Flow 为视图的用户提供了一个 flowExecutionUrl 变量,它包含了流程的 URL。该链接将一个_eventId 参数关联到 URL 上,以便返回到 Web 流程时触发 finishaed 事件。这个事件将会使流程到达结束状态。

返回开始

show.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>




Insert title here




Spring Web Flow 例子

Spring Web Flow 为视图的用户提供了一个 flowExecutionUrl 变量,它包含了流程的 URL。该链接将一个_eventId 参数关联到 URL 上,以便返回到 Web 流程时触发 finishaed 事件。这个事件将会使流程到达结束状态。

结束

配置文件-流程定义文件 spring-flow.xml




5、配置文件-spring配置和web flow织入相关配置

springmvc-servlet.xml内容


    

applicationContext-webflow.xml 内容



6、web.xml 内容



springwebflowencodingFilterorg.springframework.web.filter.CharacterEncodingFilterencodingUTF-8forceEncodingtrueencodingFilter/*mvcorg.springframework.web.servlet.DispatcherServletcontextConfigLocationclasspath:spring/springmvc-servlet.xml1mvc/  

7、运行

http://localhost:8085/springwebflow/index.jsp


8、下载

http://download.csdn.net/download/bestcxx/9984731





本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部