I use cocoon with MySQL, Hibernate and cForms and I don't know db4objects, so the suggestions below might be wrong

1. Adding jar file

You should place your database in pom file. I have mysql defined like this:

<dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.0.5</version>
</dependency>

Try to find your database in maven repository. If it is not there you have to add your database jar file into your local maven repository by running something like this:

mvn install:install-file -DgroupId=xxx -DartifactId=xxx -Dversion=xxx -Dpackaging=jar -Dfile=path/database.jar

2. Creating xml

2.1. sitemap:

<map:match pattern="*-flow">
        <map:call function="{1}"/>
</map:match>
<map:match pattern="*-jx">
        <map:generate type="jx" src="views/{1}.jx"/>
        <map:serialize type="xml"/>
</map:match>

2.2. flow

function myData() {
var appCtx=cocoon.context.getAttribute (WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
        application=appCtx.getBean("myApplicationService");
        var myData=application.readMyData();
        cocoon.sendPage("myData-jx",{myData: myData});
}

2.3. myData.jx file

<myData xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>
        <jx:forEach var="myDatum" items="${myData}">
<myDatum code="${myDatum.getID()}">${myDatum.getSomethingElse()}</ myDatum>
        </jx:forEach>
</myData>

First you run url .../myData-flow, which will go to flow, get to your java code to read the data and call myData-jx. myData.jx will get the data from object and build your xml file.

Barbara

On 28 Jul, 2008, at 10:48 pm, jantje wrote:


Well,

Actually I try to replace the old XSP. So I want to generate xml. A large chunk of this xml has to be generated with java source code (accessing a java database). In XSP it was simple: XSP, containing executable java source
code, and generating xml..

I don't even know how to start in cocoon 2.2, because I don't know the
alternative for XSP and I also can't find information (or documentation) on
this.

Maybe in "jx", It is possible, but there I can't find tags in which I can
include java source code, like I did in XSP.

Thanks for your replies..





jantje wrote:

Hi there, is het possible to use the db4objects database with Cocoon 2.2?

If so, then where should I place the the .jar file? And how can I execute
java source in cocoon? Is this possible in <map:generate type="jx"
src="cocoon:/{1}.test.xml" />

Thanks..


--
View this message in context: http://www.nabble.com/cocoon-%2B- db4odjects.jar-tp18689963p18700489.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to