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
406 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
Comment Utility

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
Comment Utility
Thanks for the help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

744 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

16 Experts available now in Live!

Get 1:1 Help Now