Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: Session


Message #1 by Liming Xu <lxu@t...> on Wed, 20 Jun 2001 10:50:31 -0400
You have mentioned "test3.jsp" in the action attribute of the form on
"page2.jsp". Its a mistake since you wish to move to "page3.jsp". One of the
possible errors...

> -----Original Message-----
> From: Liming Xu [mailto:lxu@t...]
> Sent: Wednesday, June 20, 2001 7:51 PM
> To: Pro_JavaServer_Pages
> Subject: [pro_jsp] Session
>
>
> Hi, I'm not sure what's going on here... I did three test page..
> page1.jsp,
> page2.jsp page3.jsp
>
> on page1.jsp, I simply assigned a session value and then sendRedirected to
> page2.jsp
>
> -----------page1.jsp------------------------
>
> <%
> 	session.putValue("color","green");
> 	response.sendRedirect("page2.jsp");
> %>
>
>
> on page2.jsp, which is just a page with a simple form
>
> -----------page2.jsp---------------------------
> <%
> 	String color=(String) session.getValue("color");
> 	out.println(color+"<p>");
> %>
>
> <HTML>
> <head><title></title></head>
>
> <body bgcolor=<%=color%> >
>
> <form action="test3.jsp" method=post>
> <input type="text" name="text1">
> <input type="submit" name="submit" value="submit">
> </form>
>
> </body>
> </HTML>
>
> At this point, when i reach from page1.jsp to page2.jsp, page2.jsp will
> print the color "green" on top and the form on the bottom...but when I
> submit the form and get me to page3.jsp
>
>
> ----------page3.jsp-----------------
>
> <%
> 	Stirng color=(String) session.getValue("color");
> 	out.println(color);
> %>
>
> this page will shows "null" all the time.... so somewhere from
> page2.jsp to
> page3.jsp, the session value "color" is losted.... any
> idaes????????? please
> help...

  Return to Index