Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 6th, 2005, 02:23 PM
Registered User
 
Join Date: Jun 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Mistery dissapearance of a session

I have a class which sets session parameters using
session.putValue( "param1", "value1");
session.putValue("param2", "value2");

and then redirects to a JSP page:

response.sendRedirect( "http://localhost:8889/app/somepage.jsp")

somepage.jsp retrieves session params using this scriptlet:

<%
String param1 = "";
Object o = pageContext.getAttribute("param1", PageContext.SESSION_SCOPE );
if ( o != null ) {
param1 = o.toString();
out.println("param1 = " + param1);
}
String param2 = "";
o = pageContext.getAttribute("param2", PageContext.SESSION_SCOPE );
if ( o != null ) {
param2 = o.toString();
out.println("param1 = " + param2);
}
%>
...
<%@ include file="header.jsp" %>
...
<%
if (param2.compareTo("") != 0 ) {
out.flush();
pageContext.include( "welcome_" + param2 + ".jsp );
}
else {
out.println( "page not included")
%>
...
<%
if (param1.compareTo("") != 0) {
out.flush();
pageContext.include( param1 + ".jsp" );
else {
%>
...
<%@ include file="footer.jsp" %>

But the attributes retrieved from session here are nulls as I get message "page not included".
Isn't sendRedirect() supposed to preserve the session and only create a new http request!?

I tried with encodeURL(), no success.
I ensured IE accept all cookies, again no success. Do not know what else to try?

thanks,
mile





Similar Threads
Thread Thread Starter Forum Replies Last Post
Session nook ASP.NET 1.x and 2.0 Application Design 1 July 19th, 2007 02:45 PM
about session sureshaec ASP.NET 2.0 Basics 1 June 6th, 2007 01:24 AM
session lakshmi devi Classic ASP Basics 4 July 20th, 2006 04:33 AM
Mistery dissapearance of a session!? navrsale Pro JSP 1 June 16th, 2005 06:21 AM
session and cookie problem (empty session file) msincan BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 February 27th, 2005 05:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.