Simple Spring Web Flow Webapp

David Winterfeldt

2008


A very simple Spring Web Flow 2.3 example using a flow to create and edit a Person. A Spring MVC annotation-based controller still handles search and deleting records. The example is built on Simple Spring MVC Form Annotation Configuration Webapp and Simple Spring Security Webapp which can be referred to for better explanations of Spring MVC Annotations and Spring Security.

1. Web Configuration

This would be optional, but to use any of the Spring JavaScript the ResourceServlet needs to be configured. You can see some basic resources loaded in the excerpt from the master Tiles template.

Excerpt from /WEB-INF/web.xml
                
<!-- Serves static resource content from .jar files such as spring-faces.jar -->
<servlet>
    <servlet-name>resources</servlet-name>
    <servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
    <load-on-startup>0</load-on-startup>
</servlet>
    
<servlet>
    <servlet-name>simple-form</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value></param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<!-- Map all /resources requests to the Resource Servlet for handling -->
<servlet-mapping>
    <servlet-name>resources</servlet-name>
    <url-pattern>/resources/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>simple-form</servlet-name>
    <url-pattern>*.html</url-pattern>
</servlet-mapping>