2
Contributors
15
Replies
16
Views
6 Years
Discussion Span
Last Post by martin5211
0

If the method sessionDestroyed() is declared static it's possible to access it from the logout method using SessionCounter.sessionDestroyed() .

0

If the method sessionDestroyed() is declared static it's possible to access it from the logout method using SessionCounter.sessionDestroyed() .

okay im using this to logout

<a href="j_acegi_logout" target="_top"><fmt:message key="top.logout"><fmt:param value="${model.user.username}"/></fmt:message></a>
0

Create a new method in SessionCounter, let's say discount():

public static void discount() {
		if(activeSessions > 0)
			activeSessions--;
	}

Then, call discount() from wherever you do logout, preferable from the servlet:

import com.stardeveloper.web.listener.SessionCounter;

. . .

SessionCounter.discount();
0

I'm thinking a better method:

HttpSession s = request.getSession(false); 
s.invalidate();

Destroying the session directly.

0

I'm thinking a better method:

HttpSession s = request.getSession(false); 
s.invalidate();

Destroying the session directly.

Ok do i put this in servlet or jsp?

0

On the land page (JSP) when a user performs logout.

e.g. if the user goes to home, would be nice to get an attribute and put the destroy code inside a condition.

So, first use request.setAttribute on the logout servlet to set a property to the land page.

Then, get that property from the land page and if that property isn't null execute the destroy code.

Edited by martin5211: n/a

0

Is it possible to add the property to execute the destroy code to the button logout instead of servlet?

0

Are you using JSP or a Servlet to logout?

Im using jsp

0

The code performs a redirection after log out?

yes you will be redricted to the login page.

0

Ok, you can use sessions. Before redirection, use session.setAttribute("logout", true) . Then, into the login page you can place if(session.getAttribute( "logout" ).equals(true)){ ... } with the invalidation session code.

0

Ok, you can use sessions. Before redirection, use session.setAttribute("logout", true) . Then, into the login page you can place if(session.getAttribute( "logout" ).equals(true)){ ... } with the invalidation session code.

Thanks it works now! i have a problem with my login page, im using a form and a background but i cant get the form centered on the page, im using this code.

<div class="f2" align="center" style="border:1px solid #222; padding:0px 50px 30px 50px; margin-top:200px">
0

Post this issue on Web Design/HTML and CSS forum. I think div align="center" is deprecated. margin:0 auto; before margin-top should work.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.