Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About the Data which has been set up in Request Scope

 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think of a scenario if i set soe data in request scope and if the user presses the back button will the data inside the request scope still exists ??

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand the situation you are trying to describe, no.

Request scope only covers a single request.

If the client abandons that request -OR- if the request completes and the response is sent, thats the end of it.

Bill

 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Brogden wrote:
If the client abandons that request -OR- if the request completes and the response is sent, thats the end of it.


Is clicking the browser back button will fall under the specified list??

Becuase i think that (Clicking the back button) will be not considerded as a Request .

(I think data which is set in a request scope will be there even if he/she clicks a Back button of browser.

Any suggestions.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PavanPL KalyanK wrote:

Becuase i think that (Clicking the back button) will be not considerded as a Request .


Yes . [but if you prevent browser cache , the request get call on server side . i see this behaviour in tomcat]


PavanPL KalyanK wrote:

(I think data which is set in a request scope will be there even if he/she clicks a Back button of browser.



Here you confused with Browser Cache !
 
Surya Kant
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But i have observed that clicking back button will make another request to server.
I am really confused .Can anybody clear this doubt with some meaning ful explanation?
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surya Kant wrote:But i have observed that clicking back button will make another request to server.


Well, for that you need to prevent the browser Cache .otherwise it wont be happen
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exact behavior on clicking the back button depends on many things - in addition to cache control, there may be JavaScripts on the page activated by the page being re-displayed and any number of other possibilities. You can't rely on all browsers behaving exactly the same way.

In any case, the first request is gone, long gone. It is up to you the programmer to correctly handle any data you want to keep.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic