cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Upayavira>
Subject Re: generator type value substitution
Date Thu, 29 Apr 2004 11:50:20 GMT
Ugo Cei wrote:

> Il giorno 29/apr/04, alle 11:11, Leszek Gawron ha scritto:
>> As I have stated before this is not a WEB application. I use cocoon 
>> as xml
>> data provider for my C++ application. I know this usage is not common.
>> I have used xsps before but I decided to switch to a compiled 
>> solution. I had
>> lot of problems with compile time errors and completely no support in
>> refactoring I have now with eclipse and java generators.
> Wouldn't it be possible to retrieve your data into JavaBeans and 
> serialize them to XML using one of the many Java-to-XML serialization 
> libraries (XMLBeans comes to mind and Cocoon already includes Castor)?

Or, you could use the flow/javabean/jxtemplate approach. It really is 
quite easy, and powerful.

What you do is:
* forward the request to a flow function
* That function instantiates a java bean object, and calls methods on it 
to get data into it
* Then call cocoon.sendPage, calling a pipeline that begins with a 
JXTemplateGenerator, and passing it the javabean object, which'll be 
available to JXTemplateGenerator
* In the JXTemplateGenerator, you can interrogate your javabean in many 
ways, e.g. with <jx:for> or <jx:if>, and accessing bits of your java 
beans with either JEXL or JXPATH, so maybe 

That's how I would do it these days.

And then, if you want to, you can have your javabean, which is accessed 
from flow, making connections to some object relational mapping tool, to 
get even cleverer.

Just in case this approach is useful. feel free to ignore me.

Regards, Upayavira

View raw message