cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank Taffelt" <>
Subject Re: [RT] Flowmaps revisited
Date Wed, 10 Oct 2001 15:19:18 GMT

great!!  I'm also very interested in this topic.

3 weeks ago, i also started to implement a statemachine as a controller in a
MVC scenario embedded in cocoon2 as the publishing layer.

it would be fine, to share all the ideas in this topic to make cocoon2 ready
for applications.
it's really funny, to see that others has the same things in mind !!

i will left the pro's and contra's because you explained them very well.

ok, here is my solution:

the flow is defined in a separate place:

<states init="forminit">

  <state name="forminit" view="forminit_view">
    <transition to="formaction">
      <action name="add" fail="error"/>
    <transition to="formaction">
      <action name="remove" fail="error"/>
    <transition to="formsubmit">
      <action name="submit" fail="error"/>

  <state name="formaction" view="formaction_view">
    <transition to="formaction">
      <action name="add" fail="error"/>
    <transition to="formaction">
      <action name="remove" fail="error"/>
    <transition to="formsubmit">
      <action name="submit" fail="error"/>

  <state name="navigation" view="nav_menu">
     <transition to="forminit">
      <condition type="request" name="choice" value="edit"/>
      <action name="initdata" fail="error"/>

  <state name="formsubmit" view="formsubmit_view">

  <state name="formcancel" view="formcancel_view"/>
  <state name="error" view="formerror_view"/>


the entry in the sitemap:

  <map:match pattern="fxforms-state/*.fxf">
   <map:act type="statemachine" src="&fxforms;/fxforms.xml">
     <map:parameter name="prefix" value="&fxforms;/actions/"/>
     <map:parameter name="eventgenerator"
     <!-- the view parameter seems to be a bug !! -->
     <map:redirect-to resource="{../view}" target="{../1}"/>

the "eventgenerator"-parameter is responsible for generating application
depending events and delegates them to the statemachine for evaluating.

after evaluating the next state and applicationlogic (during the
transition), let cocoon publish the data
(redirecting to a sitemap defined resource) :

<map:resource name="forminit_view">
 <map:aggregate element="fxforms">
   <map:part src="cocoon:/fxforms/model/{target}.xml"/>
   <map:part src="cocoon:/fxforms/data/{target}.xml"/>
 <map:transform src="&fxforms;/stylesheets/fxforms_html.xsl"/>
 <map:transform src="&fxforms;/stylesheets/validation_layer.xsl"/>
 <map:serialize type="html"/>

<map:resource name="formsubmit_view">
   <map:generate type="serverpages" src="&fxforms;/view/showdata.xsp"/>
   <map:serialize type="xml"/>

showdata is a small xsp-page generating xml from the Application:

<!-- example -->
    DOMStreamer ds = new DOMStreamer (new
    <!-- the data is stored in the session, i think there are better ways
for doing that -->
    Document doc =
(Document )request.getSession(true).getAttribute("FXFORMS_DATA_XPATH"); (doc);

A possible problem can occur if a page is opening an extra window (with
javascript) in the application flow. The application is in 2 parallel states
at the same time. A possible solution can be a FSM with substates ??

I hope to give this discussion some new sights and would like to get some
feedback in this topic.


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

View raw message