Getting started with Spring Web Flow 2.0

Source: Internet
Author: User
Tags config xmlns

To implement the shopping cart process for the sample application, follow these steps:

Import a related class library under the/web-inf/lib directory

Add a configuration with Spring Web flow integration in Webmvc-config.xml

Add a configuration file for Spring Web flow webflow-config.xml

Add a flow definition file Shopping.xml

Add three JSP pages

Modify Index.jsp

Import a related class library under the/web-inf/lib directory

Import the following jar packages into the/web-inf/lib directory:

Org.springframework.webflow-2.0.2.release.jar

Org.springframework.js-2.0.2.release.jar

Org.springframework.binding-2.0.2.release.jar

Jboss-el.jar

Adding a configuration to the Webmvc-config.xml

The Spring Web MVC-related configuration was previously analyzed, and the complete configuration is shown in Listing 13:

List Webmvc-config.xml<?xml version= "1.0" encoding= "UTF-8"?>
<beans
Xmlns= "Http://www.springframework.org/schema/beans"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
Xsi:schemalocation= "Http://www.springframework.org/schema/beans
Http://www.springframework.org/schema/beans/spring-beans.xsd ">
<bean
Id= "Viewresolver"
class= "Org.springframework.web.servlet.view.InternalResourceViewResolver" >
<property name= "Viewclass" value= "Org.springframework.web.servlet.view.JstlView" >
</property>
<property name= "prefix" value= "/web-inf/jsp/" >
</property>
<property name= "suffix" value= ". jsp" >
</property>
</bean>
<bean
Id= "Viewmappings"
class= "Org.springframework.web.servlet.handler.SimpleUrlHandlerMapping" >
<!--/shopping.do requests are handled by Flowcontroller-->
<property name= "Mappings" >
<value>/shopping.do=flowcontroller </value>
</property>
<property name= "DefaultHandler" >
<!--Urlfilenameviewcontroller will map requests such as "/index" to the view named "Index"-->
<bean class= "Org.springframework.web.servlet.mvc.UrlFilenameViewController"/>
</property>
</bean>
<bean
Id= "Flowcontroller"
class= "Org.springframework.webflow.mvc.servlet.FlowController" >
<property name= "Flowexecutor" ref= "Flowexecutor"/>
</bean>
</beans>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.