Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Problem

 
anieruddha gaikwad
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MyApp
|
|
|---[JSP]
| |
| |-[Module1]
| |-[1.jsp]
| |-[2.jsp]
| |-[3.jsp]
|
|---[WEB-INF]
|
|--[classes]
|
|-[MyServlet]

I submit my request to MyServlet as /servlet/MyServlet and in response got the 1.jsp as well as initialiing session variables. Next I upload file from 1.jsp and Data post to /JSP/1.jsp. this jsp used some functionality to parse the file and store it on disk. After that process over the page completes loading and Now When I submit it to /servlet/MyServlet.
The problem is when I submit to /servlet/MyServlet second time, the previous session is not exist.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some code would be helpful..
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Next I upload file from 1.jsp and Data post to /JSP/1.jsp. this jsp used some functionality to parse the file and store it on disk. After that process over the page completes loading and Now When I submit it to /servlet/MyServlet


Submitting the request to same 1.jsp ? Check if you have created a new session in between these..
 
Lorenz Baylon
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may try to check if your browser has cookies disabled, or check for lines in your code that may have invalidated the session.
 
anieruddha gaikwad
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Sebastian, I can not post the code.

Yes Balu, I am submitting the request to the same file. The project is already developed and I can not add any servlet to it. Actually the 1.jsp job is to upload the file and store it at server.

Hi lhorenz, I checked with Browser settings, that was not problem. But MyServlet is checking the session and it can not identify the old session.


My question is :- submitting the request to /servlet/MyServlet and /JSP/1.jsp can use the same session (already exist), As both are in same application ?.

And thnaks all for your reply.


 
Lorenz Baylon
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But MyServlet is checking the session and it can not identify the old session.

Did you mean that the old session was terminated? Or it is just the session attributes that are gone? What is the result if you check session.isNew() ?
 
manoj r patil
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a wild guess-

check session timeout parameter, if you have not set it, its by default 30 min.

If it takes more time to upload the data than your session timeout period, then by the time you get ready to submit the page, your session would time out.
 
aniruddha gaikwad
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The session get reset and I m getting different session id.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The session get reset and I m getting different session id.


That does means that your browser cannot maintain session with server. Check if cookies are enabled. or use encodeURL().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic