This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Gurus Please help me. I have a jsp (test.jsp) which contains <%@ include file="/jsp/header.jsp" %> header.jsp contains banner page, import java packages etc. In my test.jsp I am trying validate the page for a session If user is not logged in then i am trying to redirect the page to login.jsp Now the problem is i tried to use <jsp:forward page="/jsp/login.jsp"> <jsp aram name="param1" value="value2"/> </jsp:forward>
it din't work Then I also tried response.sendRedirect("/jsp/login.jsp");
even this one didn't seem to work. Nothing happens in the page except it displays the banner Do you think is it because include file? Thanks in advance I really appreciate your help Maria
yes if your include is writting out some data then a redirect won't work. Your redirect needs to be before anything is written out.
Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
Joined: Oct 27, 2003
Thank you so mcuh for your help. I just put my session tracking code in header.jsp file and redirect is working fine. But I am not able to successfully able to pass the session First I login through login.jsp -> it takes me to TestServlet, I retrive some data from the database and dispaly it back in test.jsp Update button in test.jsp screen takes me back to TestServlet and from the TestServlet it forwards(Request Dispatcher) request to update.jsp test.jsp -> TestServlet -> test.jsp -> TestServlet -> update.jsp -> TestServlet ->test.jsp session is available till update.jsp after that i get null for the seeion value I am using SessionCalss sess = (SessionClass) session.getAttribute ("INFO");
and i also tried to use hidden field for session in jsp and retrive the value in servlet using rea.getParameter but the result is same I am not able to understand why i am able to get the session after update.jsp? Am I doing any thing wrong? Is there any better way to achieve the same