Logout Page Customization in Jaspersoft :

When we click on Log out link in jaspersoft or when the session expires , it is always redirected to Jaspersoft Login Page.

Now if we want to see any other page or let say we want a proper message saying that

“You have successfully logged out” .

So for this , I have created one “logout-custom.htm” file and placed it to the below location :

C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro

Then , I modified decorator.jsp :

<li id=”main_logOut” class=”last”><a onclick=”exitUser()”><spring:message code=”menu.logout”/></a></li>

here , on click of Log out , written one function .

function exitUser(){

var currentUser =

‘${sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}’;

    // This fetches the current username (logged in user) from the session scope.

var loggedInUser=’${sessionScope.SPRING_SECURITY_LAST_USERNAME}’;

if(currentUser.toUpperCase()===loggedInUser.toUpperCase()){

var xhttp = new XMLHttpRequest();

xhttp.onreadystatechange = function() {

if ((xhttp.readyState == 4 && xhttp.status == 200) || (xhttp.readyState == 4 && xhttp.status == 302)) {

window.location.href = “./logout.htm”; // it will redirect to custom logout page that we want to see.

}

}

xhttp.open(“GET”, “exituser.html”, true);

xhttp.send();

}else{

window.location.href = “exituser.html”;

}

}

Rupam Bhardwaj

Leave a Reply