Posted By:
Anonymous
Posted On:
Wednesday, September 7, 2011 08:35 PM
Hi all I just wrote my first servlet filter and am already ahving problems. What I wanted to do was to make the filter handle authentication so that if a protected page was being requested, the filter would cut in and redirect to a login page. If the login succeeded, the filter would then redirect the user to the original page requested. To give an example, one of the pages in question is a blog page. When a user clicks on "Leave a comment", he is redirected by the filter to a login page if he hasn't logged in already. Up until here, the filter does it's job. Then the user logs in and the username/password is checked. If they're ok, a session variable is set in the jsp and the page redirected to the comments page
More>>
Hi all
I just wrote my first servlet filter and am already ahving problems. What I wanted to do was to make the filter handle authentication so that if a protected page was being requested, the filter would cut in and redirect to a login page. If the login succeeded, the filter would then redirect the user to the original page requested.
To give an example, one of the pages in question is a blog page. When a user clicks on "Leave a comment", he is redirected by the filter to a login page if he hasn't logged in already. Up until here, the filter does it's job. Then the user logs in and the username/password is checked. If they're ok, a session variable is set in the jsp and the page redirected to the comments page again. That request goes through the filter where I check the session variable. But no matter what, the session I get from the request seems to be a new one with no attributes set. I've tried calling request.getSession(false) and that seems to always return null. So not giving me the same session back that my jsp pages share.
I'm using tomcat 7.0.2. I don't know if this is tomcat specific or that there is just some very obvious thing that I'm missing.
Hope you cna help me.
Gisli
<<Less