cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars Huttar <>
Subject Re: AJAX and Cocoon - Design Patterns
Date Mon, 03 Oct 2005 21:01:48 GMT
Johannes Textor wrote:

>Hi everybody,
>I have some thoughts about Cocoon and AJAX that I want to share with
>you. They are somehow related to the "Is cocoon obsolete?"-thread on the
>dev list, but I think users also should express their opininons :) To
>sum it up, it has come into my mind that AJAX strengthens the "classic"
>Cocoon component approach, while somehow it does not fit up well with
>the Flowscript - JX Template - Hibernate/Spring/OJB/whatever pattern.
>Let me explain.
>I have put into production quite a few Cocoon based websites and also a
>more complex intranet knowledge base application, most of them used
>Hibernate to complement Cocoon in the "M" part of "MVC", while relying
>on Java Classes and Flowscript for the "C" part, JX Templates + XSLT for
>the "V". Though it took me some time to get into it, I am now
>comfortable with this way of building web apps. I also use CForms for
>data manipuation, even though I frankly do not like it very much, it's a
>little to bloated for my taste. And now the AJAX hype dropped in ...
>I was absolutely excited about the whole AJAX stuff and decided to give
>it a try and use it in my next cocoon based project. Now there was a
>small dilemma: What I had started to like most about Cocoon, i.e. the
>Flowscript/Java/CForms approach, now suddenly seemed a little obsolete
>since all the user interaction was taking place on the client. No more
>need for continuations - no more need for server-side validation - all
>that stuff was done in the client, who would send CRUD - requests  to
>the server side. Here, I only needed to make sure the user was
>authenticated and the requested transaction was valid, and then execute
>it. So no more multi-page transactions that were so fun and easy with
>So I remembered the good old days of writing custom Generators and
>Actions in Java - and a design pattern came into my mind that would fit
>my needs quite well. Have a look at an example pipeline:
><map:match pattern="article-edit">
>  <map:act type="article-edit">
>    <map:generate type="article" label="xml" />
>    <map:transform src="stylesheets/artikelxml2html.xsl">
>    <map:serialize type="xhtml" />
>  </map:act>
>  <map:serialize type="xml" />
>The action executes CRUD operations. The custom generator produces SAX
>events from the DB. The view is an exit point for the AJAX client who
>needs the XML representation of the data. The XHTML fragments are also
>used by the AJAX client to render the view (no client-side XSL processing).
>So, I get everything I need from one single pipeline:
>- Handling CRUD operations
>- XML Data representation
>- XHTML Data view
>However, application flow control has moved to the client, so there is
>suddenly no more need for flowscript and friends. Everything gets
>simpler (on the server side) and nicely fits into the "classic" cocoon
>concepts (I remember some weeks ago there was a thread about if actions
>were still recommended).
>So I am curious: How are your experiences with Cocoon and AJAX ? Did you
>try something familiar ? What is your pattern for designing
>Cocoon/AJAX-Applications ? Do you also feel the new way of building web
>apps is questioning some essential parts of Cocoon ? I would appreciate
>any comments.
We haven't tried anything as sophisticated as what you've done. We also 
haven't "moved up" to using Flow / CForms / JXTemplates.
We've been using good old traditional Cocoon components like XSP/ESQL, 
and we found it pretty easy to fit simple AJAX features (asynchronously 
fetching a list of choices for a dropdown) into that framework.


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

View raw message