cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Coboos <cromo...@gmx.net>
Subject Re: Set attribute to session in flowscript (more infos...)?
Date Thu, 25 Dec 2003 21:04:12 GMT
Stephan Coboos wrote:

> Stephan Coboos wrote:
>
>> Hello,
>> I want to set an object into the session scope in a flowscript. My 
>> code looks like the following:
>>
>> var user = new Packages.foo.bar.User();
>> cocoon.session.setAttribute("user", user);
>>
>> The problem is, that cocoon sets an 
>> org.mozilla.javascript.NativeJavaObject into the scope instead of my 
>> user object. Is there a way to set my user object into the session 
>> scope without writing another component?
>>
>> Thank you!
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
> Hello,
>
> I must add some informations to my posting before. If I access the 
> attribute in my flowscript, all works fine and I will get an object of 
> type foo.bar.User but if I retrieve the object from the session within 
> an action, I will get an object of type NativeJavaObject. Why? Is 
> there a way to store an object of type foo.bar.User into the session 
> within a flowscript?
>
> Thank you...
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
Hello,

I have found a solution, but I don't know whether I may use this 
solution without falling into problems. I'am using the session-fw and 
the following code in the flowscript:

var sessionManager = 
cocoon.getComponent("org.apache.cocoon.webapps.session.SessionManager");
var session = sessionManager.getSession(true);
session.setAttribute("user", user);

Is this way OK?




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


Mime
View raw message