论坛首页 Java企业应用论坛

一个关于SWF(spring webflow)的DEMO

浏览 3820 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-04-11  

自己做了一个关于关于SWF的例子,希望能给你带来方便,谢谢!

 

web.xml-----------

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
 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">
 <display-name>swfdemo</display-name>
 <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath:applicationContext*.xml</param-value>
 </context-param>
 <listener>
  <listener-class>
   org.springframework.web.context.ContextLoaderListener
  </listener-class>
 </listener>
 <servlet>
  <servlet-name>app</servlet-name>
  <servlet-class>
   org.springframework.web.servlet.DispatcherServlet
  </servlet-class>
  <init-param>
   <param-name>contextConfigLocation</param-name>
   <param-value>
    /WEB-INF/webflow.xml
   </param-value>
  </init-param>
 </servlet>
 <servlet-mapping>
  <servlet-name>app</servlet-name>
  <url-pattern>*.swf</url-pattern>
 </servlet-mapping>
 
 <filter>
  <filter-name>characterFilter</filter-name>
  <filter-class>
   org.springframework.web.filter.CharacterEncodingFilter
  </filter-class>
  <init-param>
   <param-name>encoding</param-name>
   <param-value>UTF-8</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>characterFilter</filter-name>
  <servlet-name>app</servlet-name>
 </filter-mapping>
 
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
   
  </welcome-file-list>
</web-app>

 

webflow.xml-----------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
  "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
  <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>
  <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/"/>
    <property name="suffix" value=".jsp"/>
  </bean>
 
   <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basenames">
      <list>
        <value>com.swf.swf</value>
      </list>
    </property>
  </bean>
 
  <bean name="/demo.swf" class="org.springframework.webflow.executor.mvc.FlowController">
    <property name="flowLocator">
      <bean class="org.springframework.webflow.registry.XmlFlowRegistryFactoryBean">
        <property name="flowLocations">
          <list>
            <value>classpath:com/swf/*.xml</value>
          </list>
        </property>
      </bean>
    </property>
     <property name="defaultFlowId" value="getSWF"/>
  </bean> 
</beans>

swf.xml------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
  "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
 
 <bean id="getDemoAction" class="com.swf.GetDemoAction"/>
 
</beans>

getSWF----------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE flow PUBLIC "-//SPRING//DTD WEBFLOW 1.0//EN"
 "http://www.springframework.org/dtd/spring-webflow-1.0.dtd">
 <flow start-state="getSWF">
  <action-state id="getSWF"  >
    <action bean="getDemoAction"/>
    <transition on="*" to="finish"/>
  </action-state>
  <end-state id="finish" view="swf/index"/>
  <import resource="swf.xml"/>
</flow>

 

其详细资料请见附件,谢谢!!!

 

 

  • SWFDemo.rar (3 MB)
  • 描述: 在tomcat中运行没有问题!!
  • 下载次数: 1130
   发表时间:2008-10-17  
运行附件时没有跳到“Welcome to here!”这个页面呢
0 请登录后投票
   发表时间:2008-10-30  
SWF是个好东西,学起来也不太费劲!配置文件基本都能看懂!很好很方便,我在我前一个项目里面用了这个,不错。很爽
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics