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



Jan 16, 2012, 11:43 AM
45 Posts

Log Out and Redirect Button

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: End user
  • Tags:
  • Replies: 1
Hi,
 
I am trying to implement a basic Log Out button. I have no problem adding this to a Link Control, but cannot get it working using a Button, any help would be appreciated. I am using
 
............./application.nsf?logout&redirectto=/application.nsf.
 
As I want to redirect back to the log in screen.
 
I am not sure if I should be using the 'Open Page' Simple Action or Javascript.
 
 
Any help would be appreciated. 
Jan 20, 2012, 8:23 AM
272 Posts
Re: Log Out and Redirect Button
Hi,
 
context.redirectToPage won't work because it always adds a .xsp to the url.
But you could use this SSJS code in your button:
 
<xp:button value="Label" id="button1">
   <xp:eventHandler event="onclick" submit="true" refreshMode="complete">
      <xp:this.action>
         <![CDATA[#{javascript:
            var appUrl = facesContext.getExternalContext().getRequest().getContextPath();
            var url = appUrl + "?logout&redirectto=" + appUrl;
            facesContext.getExternalContext().redirect(url);
         }]]>
      </xp:this.action>
   </xp:eventHandler>
</xp:button>
 
Hope this helps
Sven
 

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