cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <DHo...@csir.co.za>
Subject Altering session variables via flowscript
Date Fri, 09 Nov 2007 09:57:36 GMT
Working with Cocoon 2.1.8.
 
I have set a session value for a user, using the session transformer 
in the sitemap.  I now want to alter that value, based on other 
conditions.
 
My sample testing flowscript code looks like:
 
//1. get user's current session  value
var _authContext  = contextMan.getContext("authentication");
var _currUserFrag = authContext.getXML("/authentication/colors"); 
var _currUserColors = Packages.org.apache.cocoon.xml.dom.DOMUtil.getValueOfNode(_currUserFrag);
print ("current Colors for user:" + _currUserColors);
//2. 
newColorID = "blue"
var newUserColors = _currUserColors + ',' + newColorID;
print ("new Colors:"+newUserColors);
//3. set new value in session
cocoon.session.setAttribute("cocoon.session.authentication.colors",newUserColors);
//4. check user's  new session value
_authContext  = contextMan.getContext("authentication");
_currUserFrag = authContext.getXML("/authentication/colors"); 
_currUserColors = Packages.org.apache.cocoon.xml.dom.DOMUtil.getValueOfNode(_currUserFrag);
print ("revised Colors for user:" + _currUserColors)
 
Part 1 might show a value of "red"; Part 2 then shows a value of 
"red,blue" but part 4 still shows a value of "red" - what needs 
to be different in the code?
 
Thanks
Derek
 

-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice,
and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


Mime
View raw message