Solved

What is the cause of a session attribute value in a JSP being set to null when it was a string?

Posted on 2011-09-23
2
413 Views
Last Modified: 2012-05-12
I am setting the value of a session attribute to a string value in let's call JSP 1 and the next JSP that is displayed is retrieving the value and then the attribute value is null in the next JSP 2 which is displayed next.
For example:

setAttribute("var1", "acme widgets");

var1 is set to "acme widgets"

However var1 in the mean time set to null

null == getAttribute("var1")
0
Comment
Question by:jwright9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 36589431

Passing parameters between JSP through session should be straight forward
cehck this:
http://www.roseindia.net/jsp/jspsessions.shtml
You should  sue expeicitly
session.setAttribute(...)

session.getAttribute()

you may check if the session itself is not null in the second page first




this is about various ways oof passing parameters between JSP - maybe it would help
http://stackoverflow.com/questions/862440/jsp-parameter-passing-without-use-of-html-forms
0
 

Author Closing Comment

by:jwright9
ID: 36599382
Thanks for the help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question