wood burning stoves 2.0*
The moose likes Servlets and the fly likes Session Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session Problem" Watch "Session Problem" New topic
Author

Session Problem

anieruddha gaikwad
Greenhorn

Joined: Nov 26, 2006
Posts: 13
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

Joined: Feb 23, 2009
Posts: 1183
Some code would be helpful..


JDBCSupport - An easy to use, light-weight JDBC framework -
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



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

Joined: Jan 04, 2006
Posts: 99
You may try to check if your browser has cookies disabled, or check for lines in your code that may have invalidated the session.


I just cant look, its killing me.
anieruddha gaikwad
Greenhorn

Joined: Nov 26, 2006
Posts: 13
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

Joined: Jan 04, 2006
Posts: 99
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

Joined: Jun 06, 2002
Posts: 181
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.


love your job and not your company;
...because you never know when your company will stop loving you!
aniruddha gaikwad
Greenhorn

Joined: Nov 01, 2007
Posts: 19
The session get reset and I m getting different session id.
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


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().
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Session Problem