On 09.10.2007 17:13 Uhr, Josh2007 wrote:
I need to access cocoon object from a javascript scriptAction to make use of
session, request... functions.
The ScriptAction works more like a usual Cocoon Java component than like
flowscript. Therefore you have the ObjectModel available which is
actually only a Map. To access the stuff you need you use the
ObjectModelHelper and call the corresponding static methods like
getRequest() or getSession() [1]. If you have a look into ScriptAction's
source code (which is simple) you will see the other objects it
registers for usage in the JavaScript:
mgr.registerBean("resolver", resolver);
mgr.registerBean("objectModel", objectModel);
mgr.registerBean("parameters", par);
// ScriptAction housekeeping
mgr.registerBean("actionMap", actionMap);
// helpers
mgr.registerBean("logger", getLogger());
mgr.registerBean("request", ObjectModelHelper.getRequest(objectModel) );
mgr.registerBean("scriptaction", this );
mgr.registerBean("manager", this.manager );
It seems the only way to access cocoon object is to create a flowscript.
Is there another solution as I don't want to redirect to another pipeline
after the script is performed unlike flowscript does?
The cocoon object is only a simplified version to access all the stuff
in the ObjectModel. It's indeed only available in flow script.
Joerg
[1]
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/environment/ObjectModelHelper.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]