File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Session-based authentication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session-based authentication" Watch "Session-based authentication" New topic

Session-based authentication

scottie zman
Ranch Hand

Joined: Aug 08, 2001
Posts: 40
I'm developing some intranet apps in JSP and need to build a login checker mechanism. Here's what I want to do:
on each page, include loginCheck.jsp.
logincheck simply looks for a session variable, accessLevel. if it is null or not high enough for that page, it should redirect to login.jsp
sounds simple. but whenever I try a jsp:forward or a sendRedirect, I get an error regarding page buffering. I've even put the jsp:forward at the _very first_ line of code, and it still gets the error.
can someone help me out: please explain why it's causing the error when the forward command is on the first line of code and where does the page _really_ begin writing itself out to the browser. Also, if there are any tutorials available on doing this then a link would be appreciatred, or if anyone has created a better solution to managing session-based authentication, I'd love to hear about it. I'm an ASP veteran moving into JSP, so I'm all ears (and eyes) for new ways of doing the same old things.
I agree. Here's the link:
subject: Session-based authentication
It's not a secret anymore!