cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <coc...@lojjic.net>
Subject Re: fd:multivaluefield -> direct the content of the two fields!!!
Date Sat, 16 Sep 2006 19:03:14 GMT
jantje wrote:
>>>> What do you mean by "generate"?  I presume you mean get the array data
> from some external source? 
>  
>>>> The answer to your question will depend on what that external source is.

> 
> Yes, I want to get it (the content of the array) out of a database.. f.i.
> with XSP..
> Is it possible to do this? is it possible to fill the array with some kind
> of redirection or somthing? (in flowscript)
> or can I set these values this in f.i. the form definition?


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 
Packages.org.apache.cocoon.components.flow.util.PipelineUtil();
   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.)

HTH
--Jason

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message