Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP URL tracking

 
sean menezes
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone
I am SEAN MENEZES .I am working on JSP,Java beans ,JDBC,MYSQL,LINUX.I am checking the session for login on every page if not logged on i am diverting user to login page from where he is diverted to a standard page after he correctly logs in which is hard coded but i want to divert him to the page from where he originally came to login page .how do i do it please help very urgent and imp
Sean menezes
Dhamm infotech
Sean_menezes@yahoo.com
 
Brian Nice
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is one option, I'm sure it's not the best, but at the beginning of every page include the following:
<%@ include file="loginCheck.jsp" %>
This page will check the session to see if the person has logged in, and if not redirect them to the login page. In addition to redirecting te person, you could also get the URL of the page that the person is on and store that in the session:
StringBuffer currentPage = HttpUtils.getRequestURL(request);
session.setAtrtibute("currentPage", currentPage);
Now in your login page, after a successfull login, check to see if there is a value in currentPage from which to erdirect the uesr back to:
Stringbuffer redirectPage = (StringBuffer)session.getAttribute("currentPage");
Hope that helps
Brian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic