what i want to do is create a session scoped bean in my servlet and also get the values in that same servlet

i have created a bean in my servlet with a session scope(not sure if it really is in session scope) using this code:

HttpSession session = request.getSession();
        NavigationBean nav = new NavigationBean();
        session.setAttribute("nav", nav);

I first write out the beans using:

html += "currentpagebean = " + nav.getcurrentPage();
        html += "<br />previouspagebean = " + nav.getpreviousPage();

I then set them if they are null

then display them again to make sure they get set.

all that works fine.

Now when i go to another servlet the values of the initial printing out of the beans is null.

I am not sure what i have done wrong. Things that could be affecting it, and maybe it is, is that the above servlet is an attribute member of two other servlets, i used composition.
Also could it be resetting itself since it processes all the code again?

Please help

8 Years
Discussion Span
Last Post by Thirusha

I mananged to get this working, i was resetting the session bean, but now its working.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.