Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

new session between jsp pages  RSS feed

 
Teresa Dodero
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I'm a beginner with jsp/servlet/bean. And after many hours of reading, and trying I'm completely frustrated.

I'm trying to move between jsp pages, and I'm always getting a new session.
I read many articles and posts but can't find what I'm doing wrong.

In every page I include a "status.jsp" where I check if the user is logged in.


In every jsp page:
<%@ include file = "/includes/status.jsp" %>

I always get a new session.

I tried inserting the code into each jsp. Same thing: new session. I've also included
<%@ page session="true" %>
in each jsp. I know that the default is true, it's just I don't know what else I can try.

I've also tried to send the jsessionid through href.
<a href="/jsp/item.jsp?ISBN=<%=isbn%>&jsessionid=<%= session.getId()%>">view </a>
Didn't work either

I move the code from one machine to a new one 10 days ago.
Could it be a problem with tomcat?

Thanks
Teresa

[BSouther: Added UBB CODE tags]
[ January 07, 2007: Message edited by: Ben Souther ]
 
Teresa Dodero
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the problem!!!

If I access with my IP instead of localhost it works perfect!
Why???
Does anybody know?

Teresa
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It probably has to do with the way that your browser is dealing with cookies.
 
Teresa Dodero
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear,

I use IE 7 and Firfox 2, and I have the same problem with both of them.
Either if I access with localhost or 127.0.0.1 I can not handle the sessions.

But if I access from any other machine, or 192.168.1.103 in the local, everything works perfect.

The problem is, that I need it to work in this machine which is a laptop.

At least I know that it is not a coding problem. Now I have to find out if it is a browser or a tomcat issue. Or maybe both. I have no clue.

Teresa
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!