• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Session Problem

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some code would be helpful..
 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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() ?
 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The session get reset and I m getting different session id.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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().
reply
    Bookmark Topic Watch Topic
  • New Topic