cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: How to access cocoon object from javascript scriptAction?
Date Wed, 10 Oct 2007 00:07:39 GMT
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.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message