struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mraible <>
Subject Spring Web Flow Plugin Feeback
Date Thu, 15 Mar 2007 08:16:34 GMT

If I should post feedback for the SWF plugin to the user list, please let me
know.  I've been playing a bit with this plugin today.  I have a fair bit of
experience using SWF with Spring MVC and JSF, and this is the first time
I've tried it with Struts 2.

Some thoughts:

1. Using a _flowId to indicate the flow to use.

With Spring MVC, it's possible to configure something like the following:

    <bean id="flowController"
        <property name="flowExecutor" ref="flowExecutor"/>

    <flow:executor id="flowExecutor" registry-ref="flowRegistry"/>

    <flow:registry id="flowRegistry">
        <flow:location path="/WEB-INF/flow-*.xml"/>

This allows you to call the url for the flowController with a _flowId
parameter to specify the flow to use.  The default flow name is the name of
the flow's XML file.  For example: flow.html?_flowId=flow-shoppingcart to
load the /WEB-INF/flow-shoppingcart.xml flow.  This doesn't seem to be
possible with this plugin.

2. Redirecting to the controller.  I noticed in the example,
redirect-by-default is turned off:

    <flow:executor id="flowExecutor" registry-ref="flowRegistry">
            <flow:alwaysRedirectOnPause value="false"/>

I'm assuming this is done because redirects are handled by the results
themselves?  With SWF, I've often called methods on beans (actions) directly
from the flow definition rather than invoking an action based on a URL.  In
other words, Spring MVC (and JSF) always posts to /flow.html and then
redirects back to the same URL.  This is quite a bit different than the
Struts 2 example that does Struts-based redirect. SWF does allow you to do
an external redirect, but that's usually handled from w/in the flow:

<end-state id="finish" view="externalRedirect:/users.html"/>

Of course, to call methods on actions from the flow, you may have to
register them as Spring beans, but that's expected.  In many cases, you can
get away from writing controllers and just use SWF's default FormAction to
route - then call your middle-tier classes to persist and grab data.

3. It'd be nice if there were "prefix" and "suffix" values you could set on
the front "flowController" so you could use logical view names in the flow
definition, rather than having to do dual-entry in the flow definition and
struts.xml to match view names to result names.

AFAIK, all of this might be possible right now - I haven't dug into the code
too much to see.

Best Regards,

View this message in context:
Sent from the Struts - Dev mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message