my dog learned polymorphism*
The moose likes Struts and the fly likes Problem in SessionManagement in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem in SessionManagement in Struts" Watch "Problem in SessionManagement in Struts" New topic

Problem in SessionManagement in Struts

patriot indian

Joined: May 20, 2009
Posts: 9

I am having a problem doing session management in Struts.....After logging out the user has to be directed to login page. and invalidate the session..This i am doing through logoff action class...Also after logging i need to make sure that user cannot see the contents of jsp page rather be directed to login is m login action class..

My logoff action class is as follows

In all the action classes i am checking whether the (String)session.getAttribute("loggedin")==true...If not i am redirecting it to login page...This works fine...But in my jsp i am trying the same thing...

Its giving Illegal State Exception....Cannot FORWARD..The response already committedI am using a simple tile template for each of my of the page is

Its giving Illegal State Exception...What is the problem i am unable to understand..I also incresed size of buffer to 256k but still no solution....Please Help as to how to redirect to login page after session is invalidated

Thanks in advance

patriot indian

Joined: May 20, 2009
Posts: 9
Hey i solved provblem to certain extent instead of jsp:forward i used response.sendRedirect("login.jsp")...but it is not redirecting to the page...Also its not showing any error...What is causing such thing..I am giving my jsp code please help..
David Newton

Joined: Sep 29, 2008
Posts: 12617

Once data is written to the response you can't redirect.
I agree. Here's the link:
subject: Problem in SessionManagement in Struts
Similar Threads
Unable to fetch data on a specific JSP....getting error "HTTP Status 404 - /"... help.
Unable to display the Data from SQL SERVER 2005 on a JSP through <c:forEach> tags
Verification failed on Username existence check using AJAX
java.lang.IllegalArgumentException: argument type mismatch
&gt;html:text &lt; default value