cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robby Pelssers" <robby.pelss...@ciber.com>
Subject RE: classes in block / usage in flowscript
Date Thu, 04 Jun 2009 11:36:31 GMT
The proper way to access java from flowscript is to import the classes
at the top:

importClass(Packages.com.mycompany.util.MyClass);


then you can do this:
var myclass = new MyClass();

This should work if at least that package is included in the classpath.

And if you want to access beans, you should not use this construction,
neither is importing the class needed.

Then you just do:
var mybean = cocoon.getComponent("nameOfBean");

Cheers,
Robby

-----Original Message-----
From: Patrick Heiden [mailto:patrickheiden@gmx.de] 
Sent: Thursday, June 04, 2009 1:09 PM
To: users@cocoon.apache.org
Subject: classes in block / usage in flowscript

Hello together,

I am a little bit wondering about following issue.
Assume we have a Java-class inside a cocoon-block (i.e. like the demo
bean out of the tutorial).

When I get a new instance of this class through

...
var foo = new some.package.inside.block.MyClass();
...

then i get this error:

...
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "some" is
not defined.
(file:///home/pepemuck/_opt/devel/ISAC_DEV/isacBlocks/isacTermBlock/./sr
c/main/resources/COB-INF/flow/MyFlowScript.js

There is no Problem to get instances like
java.io.ByteArrayOutputStream() or the like.

So why is this error thrown when I want to get new Objects out of a
package-hierarchy inside the package-hosting block?

By the way - instantiation via 

...
var foo = MyClass();
...

works perfectly well!


Any hints to understand WHY this happens?

Thanks upfront

with best regards,
Patrick
-- 
GMX FreeDSL mit DSL 6.000 Flatrate und Telefonanschluss nur 17,95
Euro/mtl.!
http://dslspecial.gmx.de/freedsl-aktionspreis/?ac=OM.AD.PD003K11308T4569
a

---------------------------------------------------------------------
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


Mime
View raw message