Michael Wolf dijo:
> My question was more about the flow.
>
> To use the PersistenceBroker I tried:
>
> importClass(Packages.org.apache.ojb.broker.PersistenceBroker);
> importClass(Packages.org.apache.ojb.broker.PersistenceBrokerFactory);
> importClass(Packages.org.apache.ojb.broker.util.ui.AsciiSplash);
>
> function ojbTest(){
> broker = PersistenceBrokerFactory.defaultPersistenceBroker();
> }
>
> when calling the function I get the following error message:
> java.lang.NoClassDefFoundError

Ok. I understand. To be honest I don't use OJB inside javascript, because
it turns to me to be hardly debugable. Note I don't said you can not debug
javascript at all.

Also it looks very complicated to me. I prefer to build a serie of handler
and call them from inside the flow. As a Java IDE I use eclipse
(http://www.eclipse.org/)

In eclipse I create a project with the following libs:

db.jar -- created using druid - it is a container for JDO beans.
(autogenerated).
jdo.jar
jdori.jar
cocoon-ojb-block.jar
avalon-framework.jar
commons-lang-2.0.jar
commons-beanutils-1.6.1.jar (optional)
commons-jxpath-20030909.jar (optional)
db-ojb-1.0rc520031210.jar

most of the libs are from cocoon.

Then I build a dbHandler.jar with the Handler classes (one for each woody
form) using eclipse.org.

Copy the dbHandler.jar to your WEB-INF/lib and restart tomcat.

After that we can call the classes from dbHandler.jar from inside script.

Example, this script manage the creation of a user:

cocoon.load("resource://org/apache/cocoon/woody/flow/javascript/woody2.js");
cocoon.load("context://resources/flow/autentificar.js");

function createform(form) {
    if (autorizar("auth")) {
        form.showForm("create-form-display");

        var bean = new Packages.net.agssa.sga.Auth_user();
        var handler = new
Packages.net.agssa.sga.forms.auth_user.Auth_userHandler();
        var factory;

        form.save(bean);
        try {
            factory =
cocoon.getComponent(Packages.org.apache.cocoon.ojb.jdo.components.JdoPMF.ROLE);

            handler.insert(bean, factory);
        } finally {
            cocoon.releaseComponent(factory);
        }
        success("Users", "Users inserted successfully", "Create a another
user?","create");
    }
}

BTW, the Handler written in javascript will look very ugly to my eyes.
This is my view point.

I hope this would help. If not feel free to ask again :-D

Best Regards,

Antonio Gallardo

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

Reply via email to