wood burning stoves 2.0*
The moose likes Servlets and the fly likes JSP URL tracking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP URL tracking" Watch "JSP URL tracking" New topic
Author

JSP URL tracking

sean menezes
Greenhorn

Joined: Nov 06, 2000
Posts: 7
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

Joined: Nov 02, 2000
Posts: 195
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
 
Consider Paul's rocket mass heater.
 
subject: JSP URL tracking
 
Similar Threads
Struts2 : Forwarding to the requested page after login
How do I find if the current user has logged in or not
session in jsp
j2EE,EJB,jdk
How do I find the page where i am coming from in my current jsp page