• 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

Will the jsp execute if a user closes the browser?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All!
I have a jsp application that integrates with a database. I just want to know what happens if a user clicks a link and closes the browser while the request is through. Here there are 2 to 3 scenarios. What happens when a user closes the browser/click stop button immediately after clicking the link. In IE we see a status bar at the bottom. What happens when a user closes the browser/cliks stop button while it is halfway through?
I believe once the request reaches the web server, the transaction is complete.
I would greatly appreciate if you can give me some information regarding this.
Thanks!!
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HTTP is stateless -- once a request has been made -- the server will fulfill it.
If after the user makes the request -- they close the browser (or click the stop button) -- the server will have no idea the user tried to "cancel" the request -- it will fulfill the request and attempt to return the response, but the resonse will not go through.
If the user hits reload -- another request will be made, same if they click a different link before the request could be fulfilled.
 
Neeraj Sharma
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jessica:
Thanks for the reply. But I have observed a scenario. Let's take example of yahoo mail "Bulk Mail" and "Sent Mail". I tried clicking on them both one after another immediately. The result is random.
Also, what happens when the user hits stop button or close the browser when the request is still through(When the blue status bar below is half way through).
Thanks in anticipation.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the browser closes the socket, the servlet will get an IOException when it tries to write content - this will be when the buffer is full, or when out.flush() is called. So a JSP may not execute all the way through and the transaction will NOT be complete.
Its not uncommon to see this exception in logs.
Bill
 
Neeraj Sharma
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
I just checked it practically. Now after I made the request, while the status bar is still through
i.e immediately after i see the blue color in the status bar I closed the browser/ hit stop button. I noticed that the request was through and the database is updated. So once, the link is clicked it is through.
But, I am observing the following in the log file :
The first log is when I make the request and close the browser immediately (I can see the status bar below). The second log is when I wait till the end. They both look same
2003-04-25 11:29:57 SessionListener: sessionCreated('064BAAAD2AA39F7565B2961C2FBD0AD6')
2003-04-25 11:29:57 SessionListener: attributeAdded('064BAAAD2AA39F7565B2961C2FBD0AD6', 'wb3', 'pavan.WorkBean@1b717928')
2003-04-25 11:35:10 SessionListener: sessionCreated('53505D958B717354D82358D8EC1BA8F2')
2003-04-25 11:35:10 SessionListener: attributeAdded('53505D958B717354D82358D8EC1BA8F2', 'wb3', 'pavan.WorkBean@49a03929')
 
Neeraj Sharma
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
I just checked it practically. Now after I made the request, while the status bar is still through
i.e immediately after i see the blue color in the status bar I closed the browser/ hit stop button. I noticed that the request was through and the database is updated. So once, the link is clicked it is through.
But, I am observing the following in the log file :
The first log is when I make the request and close the browser immediately (I can see the status bar below). The second log is when I wait till the end. They both look same
2003-04-25 11:29:57 SessionListener: sessionCreated('064BAAAD2AA39F7565B2961C2FBD0AD6')
2003-04-25 11:29:57 SessionListener: attributeAdded('064BAAAD2AA39F7565B2961C2FBD0AD6', 'wb3', 'pavan.WorkBean@1b717928')
2003-04-25 11:35:10 SessionListener: sessionCreated('53505D958B717354D82358D8EC1BA8F2')
2003-04-25 11:35:10 SessionListener: attributeAdded('53505D958B717354D82358D8EC1BA8F2', 'wb3', 'pavan.WorkBean@49a03929')
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic