Hello Robby,

thx for the fast reply!
...

> The proper way to access java from flowscript is to import the classes
> at the top:
> 
> importClass(Packages.com.mycompany.util.MyClass);

alright, i can get with that, but all i've done was

importPackage(Packages.some.package.inside.blockStructure);

and your following statement was also working!

> 
> 
> then you can do this:
> var myclass = new MyClass();
> 
> This should work if at least that package is included in the classpath.

.. the confusing thing to me is, that it is possible to get new Objects like 
java.io.ByteArrayOutputStream WITHOUT importing that class / package!
So why it is not possible with classes defined inside my block?

> 
> 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");

So your suggestion would be to include all Classes into Spring to get access 
through getComponent("someBean"); !? I could go with that too, even if my beans 
would have prototype scope, no problem - but my question remains: WHY ist isn't 
possible to instantiate the classes inside block like other classes inside my 
classpath?

Cheers and much thanks,
Patrick

> 
> Cheers,
> Robby
> 
> -----Original Message-----
> From: Patrick Heiden [mailto:[email protected]] 
> Sent: Thursday, June 04, 2009 1:09 PM
> To: [email protected]
> 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: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to