Dear Struts Dev,
I have launched a sub-project at the struts sourceforge site which provides
workflow functionality for struts. Essentially it is a re-write of the
struts controller and provides a significant set of additional features. I
am currently working on finalizing the struts example and writing
documentation, but the basic framework is there. 
PAGEFLOW EXAMPLE
 
Heres what a page looks like...
<page name="logon">
<location value="/logon.jsp"/>
<form>
<form-property... (same as Struts 1.1)
</page>
<page name="main">
... page declaration
</page>
 
Heres what a page flow looks like...
<flow>
<page-instance ref="logon" name="logon1">
<action name="submit" defaultDestination="main">
<steps>
            <step type="LogStep">
                        <param name="message" value="Message to log"
            </step>
            <step type="CallSessionBean">
                        <param name="beanName" value="value"
                        ... additional params
            </step>
</steps>
</action>
</page-instance>
<page-instance ref="main" name="main">
<action name="submit" defaultDestination="logon1">
<steps>
            <step type="LogStep">
                        <param name="message" value="Message to log"
            </step>
            <step type="CallSessionBean">
                        <param name="beanName" value="value"
                        ... additional params
            </step>
</steps>
</action>
</page-instance>
</flow>
 
PAGEFLOW FUNCTIONALITY
 
1. Contextual Pages: Re-use of pages across PageFlows. 
 
2. Re-usable Actions: Actions can be declared at the application or pageflow
level
and reused inside of the workflow. 
 
3. Variable Handling: You can do almost all of your web variable handling in
the xml
file instead of in code (saves loads of time!) Additionally pageflow
provides a new web scope
which is automatically cleaned up for the developer. 
 
4. Event Handling: 
- Entering, exiting, or wrapping a pageflow.
- Entering, exiting an action.
- Entering, exiting a page instance.
- Adding, removing from a scope.
- Setting values on a form, validating a form.
- Sending HTML to the client.
- An error occurs.
 
5. Re-Usable Steps: I get really tired of writing the same code over and
over again.
That is why I love workflow tools (webmethods, BEA BPM, etc.). Workflow
tools offer
me a meta programming language with which I can create re-usable steps and
just 
pass in different parameters. 
 
pageflow provides exactly the same functionality (uses the commons-workflow
library). If your application uses session
beans out of an EJB container, just use the InitialContext and
CallSessionBean steps.
Sometimes of course this wont work, either because of the complexity of the
logic
involved or your specific project context. In that case just put your custom
code
into a step and put that step into the action. 
 
6. Nested PageFlows: This is really cool! pageflow allows you to nest other
PageFlows
inside of each other. You can pass variables from one to the other.
If managed and thought through properly this could be a very powerful
feature. 
 
7. Fine-Grained Filters: I honestly dont know if anyone wants this, but it's
always
annoyed me that I could only use filters at the top web application level.
What if 
you want to convert your application to use a new filter incrementally? What
if your
filter isnt needed everywhere? Currently you would have to code the
contextual logic 
directly in your filter.pageflow allows you to put your filter at the
application, 
pageflow, page-instance and action levels.
 
8. Fine-Grained Error Handling: Another gripe I have is trying to figure out
flexible
error handling in my applications.You may use or declare error handlers at
- application layer
- pageflow layer
- action layer
 
9. Fine-Grained Form Control: I had two big beefs with Struts 1.1 forms.
Figuring out when and where forms are initialized and mapping the data
to/from my value objects. In pageflow,
each page declaration is connected with a form. The form
properties have two new elements, mapTo and mapFrom. These elemements simply
connect
the form property to two variables, one to get the value from
(session.user.name) 
and one to put the changed value into (request.changeduser.name).
 
The framework is in no way complete, but it is to the point where people can
start commenting on it. Let me know what you think.
 
Paul T Smith
 

Reply via email to