cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <>
Subject Re: How to get spring beans with Cocoon Template 1.0?
Date Fri, 21 Nov 2008 08:31:27 GMT
On Fri, 2008-11-21 at 11:43 +0800, 黄海冬公司邮箱 wrote:
> Hi,Thorsten Scherler
> There's many reasons to do this in template,But the MOST IMPORTANT IS it's
> quick and don't need to write java so it does not need to restart server.For
> a developer who just know spring and common java,it's not easy to implement
> cocoon's interface or any other specify interface even they are open source.
> I am the only one who really understand cocoon in my entire group,the other
> developers only follow my deployment guide to do the copy&paste&edit
> work.Java?they only write the common java bean.

Actually in my team they understand the basic and if you do that
creating cocoon components is quite easy. ;) 

I normally start up my projects with a training (1 day - 1 week) to get
the basic straight with everyone which makes life so much easier

The main reason I needed a bean in my jx that I had tone of lines of
repetitive  presentation logic which could be be done with a a couple of
lines real java code.

Personally I like classes with near no dependencies (small helper) and
just hook them up in cocoon does not limit the re-usability of them in
other project environments. 

> The complains above is about one problem:Cocoon is not so popular just like
> Spring or even Hibernate(at least many people knows what it is),that many
> java developers will study and undersand.

Cocoon is hardly comparable with hibernate since it is in another tier
(presentation vs. data tier communication). You can hook up all your
existing hibernate code into cocoon without any problem via spring.

Spring does offer a MVC framework but it is not thought for piping
components. However cocoon offers a way to pipe content stream via sax
events. Meaning the communication between them are sax events and you
just apply standard SAXHandlers. If you need to manipulate xml in some
part cocoon is awesome, but you do not have a 100% cocoon based app.
That has been the problem with 2.1 you needed to use avalon reducing the
usability of your custom code. With spring support in cocoon 2.2. you
are now much more free to implement it the most efficient way.

> So even better or great cocoon
> implement exist ,much fewer people know.I admit it is not a good solution,my
> groups also complain why then can't just add code in common java but in a
> xml file,but the reality is it's the best way for the project now.

That depends, in my group we are using the apache forrest dispatcher [1]
to structure our presentation layers. It is much easier to get the new
people started to create contracts and implement design guidelines. You
limit they work to a specific use case and two layer. It follows a data
producing factory and the transformation factory approach.

> BTW,I think the better way to do this is to get appctx in flowscript and
> send it to template with sendPage(url,{"appctx":attctx});

The dispatcher does not use flow but jx for the structurer files. I
hardly use flow in my apps and if so prefer java flow over js.


> Regards,
> Roy Huang
Thorsten Scherler <>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la Información, S.A.U. (SADESI)

View raw message