cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jantje <janvanop...@skynet.be>
Subject Re: fd:multivaluefield -> direct the content of the two fields!!!
Date Thu, 21 Sep 2006 11:41:42 GMT

OK, I can pass f.i. a String from a Java class to flowscript..

But I can not pass a String[] (thun an array)..

My class is as follows:

public class EmpActivities {
  public EmpActivities() {
  }

  public String[] activities() {
    String[] result = new String[2];
    result[0]="CCCCC";
    result[1]="BBBBB";
    return result;
  }
}

And my flowscript:

  var mc = new EmpActivities();
  var acModel = activitiesForm.getModel();
  acModel.addAnExistingActivity = mc.activities();

This works (so, I really don't know what's wrong on retrieving an array):
  acModel.addAnExistingActivity = ["AAAAA", "BBBBB"];

Thank you for your help!!!












Jason Johnston-3 wrote:
> 
> jantje wrote:
>> Query the database from my flowscript? I have an object oriented database
>> (db4o.com).. 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 
> http://www.mozilla.org/rhino/ScriptingJava.html 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 
>> 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
>> 
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

-- 
View this message in context: http://www.nabble.com/fd%3Amultivaluefield--%3E-direct-the-content-of-the-two-fields%21%21%21-tf2276639.html#a6426265
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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


Mime
View raw message