cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <>
Subject Re: fd:multivaluefield -> direct the content of the two fields!!!
Date Wed, 20 Sep 2006 22:22:08 GMT
jantje wrote:
> Query the database from my flowscript? I have an object oriented database
> ( is it also possible to query this database in flowscript? do
> you know where to find information about this.. and how can I f.i. do this
> in flowscript: "import com.db4o.*"
> Can someone tell me how to do this in flowscript?

If you can do it in Java you can do it in flowscript (though the syntax 
usually isn't quite as nice).  The reason is that flowscript uses the 
Rhino JavaScript engine, which allows you to script Java.  See for details.

Personally I prefer to write this sort of heavy-lifting model/DAO code 
in pure Java, and then just make simple method calls from the flowscript 
to my Java classes.  Some people prefer to do it all in flowscript 
though, because of the quick try/fail/reload cycle.

> Okay, here are a couple possibilities:
> 1) Query the database from your flowscript.  You've got the full power 
> of JDBC available to you; you can either write the query code directly 
> in your flowscript or write a Java class that does the query and gets 
> called by your flowscript.
> 2) If you really want to use a pipeline to do the query (e.g. XSP or 
> SQLTransformer), you can have your flowscript call that pipeline and get 
> the result as a DOM tree, and then grab the values out of it using the 
> DOM API...
>    var pipelineUtil = new 
>    var dom = pipelineUtil.processToDOM("query-pipeline", {});
>    var elements = dom.getElementsByTagName("...");
>    var targetArray = [];
>    for(var i=0; i<elements.getLength(); i++) {
>      targetArray.push(elements.item(i).getFirstChild().getNodeValue());
>    }
> (or something like that.)
> --Jason
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message