This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
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