Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Problem With Tomcat Session Object

  Asked By: Jodon    Date: Jun 11    Category: Java    Views: 752
  

I am using Tomcat 4 & try to set an attribiute on session & get it
down on another page. but it returns null (Such as username on login &
getting on other pages). In fact in every server request a new session
object will be created. the problem is viewd only on IE WinXP Service
Pack 1 or Higher not in other browsers. And I try Tomcat 6 & the
problem still exists.
I would be happy to reciver your guidance

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Aaron Evans     Answered On: Jun 11

Session Management could be implemented in several
ways. As I know, tomcat  relay on COOKIE(s) to managing
sessions. Mostly, the problem  you mentioned is because
of browser settings. New browsers  have some mechanisms
to block cookies from unsafe web sites or block them
at all. Probably, your browser is doing something like
that.

So, just take a look at your browser settings.

 
Answer #2    Answered By: Salvatore Kelly     Answered On: Jun 11

Example String username=request.getParameter("username");
you can create session  with session.setAttribute("username",username);
in the welcome page, you can use if (session.getAttribute("username",null){ RequestDispatcher.getRequestDispatcher("login.jsp").forward(request,response); }
to remove session, session.removeAttribute("username");

 
Didn't find what you were looking for? Find more on Problem With Tomcat Session Object Or get search suggestion and latest updates.




Tagged: