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
407 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
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

914 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now