This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Sep 1, 2011, 12:27 PM
21 Posts

Cannot set sessionScope from ssjs function

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags: ssjs sessionScope
  • Replies: 2
Hi there,
 
i tested to set a sessionScope varaible, redirect to a page and display this variable on the target page.
 
I added the following code in the onclickevent of a button:
 
sessionScope.errorPageHeader = "There is an erro...";
context.redirectToPage("ErrorPage");
 
My Test was successful.
 
Now i tried to put this code lines in a function:
 
uniqaContext = {
     // some attributes and other methods
     // ............
 
     displayErrorPage: function(head:String) {
           sessionScope.errorPageHeader = head;
           context.redirectToPage("ErrorPage");
      }
};
 
 In the button i call this method:
 
uniqaContext.displayErrorPage("some error");
 
 .... the redirect completes, but the sessionScope variable "errorPageHeader" is null!
 
 
 Any ideas?
 
Thanks Mario
Sep 1, 2011, 2:03 PM
272 Posts
Re: Cannot set sessionScope from ssjs function
Hi,
 
what about a print to the server console or your "head" - variable?
 
uniqaContext = {
     // some attributes and other methods
     // ............
 
     displayErrorPage: function(head:String) {
 print( head );
           sessionScope.errorPageHeader = head;
           context.redirectToPage("ErrorPage");
      }
};
 
Sven
Sep 27, 2011, 12:56 PM
3 Posts
Re: Cannot set sessionScope from ssjs function
 The most common type of unserializable object is SSJS functions. You may use them in the requestScope but any objects that are not serializable should not be used in higher scope.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal