First of all pardon me if the heading is misleading or confusing. Could not think of anything proper as the problem itself is weird. Here it is:
I do a normal login processing by accessing parameters in servlet as:
I validate there and move forward to subsequent pages. By doing this, according to me, I keep changing (with every request), request parameters' values because they are valid for this current request. I am clearing the cache to prevent any back button retrieval from browser. But when I click the back button and come to first page i.e the one after login, the values from the request parameter "which were there when i made the request for this page" are still there.
I debugged it and found so you can trust me on this.
I hope this clears it somewhat.
while going forward login-->access values in servlet via request parameters , assume successful validation-->home page --> next page1 --> next page2-->next page 3
I think while making all these requests, request parameter values keep changing and off course, old ones keep getting replaced.
while traversing backward through back button. All requests hit server. forced no-caching next page 3 --> next page 2 --> next page 1 --> home page
for debugging purposes i display the user id and password text box values on home page. It is more like "this is what i entered while logging in". I see those values while going forward, and rightly so. But while coming backward too, i see those values. How is it possible. There have been many requests in between and each might have changed the request parameter value.
The problem is somewhat weird and i am not sure if i have been able to convey it clearly. Please let me know if any further explanation/information is required. I would not even have found it had it not triggered some other validation issues, which I have purposely not put here because I feel that would be diverting. Just assume that this is what is happening. Is this normal behavior on part of browser. "not saving the pages but request parameter values for those pages".
I do use IE 7 . I did a small prototype ,clicking on browser's back or forth button did not trigger any request at all.This behaviour is consistant across FireFox and Chrome as well.
what is the browser/version do you use ? see if you can simulate by writting some dummy jsps and attach .war file here ,I would deploy it on my eclipse and see whats the issue.
I did a small prototype ,clicking on browser's back or forth button did not trigger any request at all.
Perhaps i missed out on something important yet again. I agree clicking on back button does not make browser query the server, on it's own, unless i refresh. You have already made that clear in your reply to my other post and i too am clear about that.
I do press refresh. Here it is again. (please read the original post for remaining part...the only thing added here is that I DO hit refresh)
while traversing backward through back button. All requests hit server by explicitly pressing refresh.
next page 3 --> next page 2 --> next page 1 --> home page
home page is one after login page. So the request parameters for home page are the ones that are entered in the login page.
for debugging purposes i display the user id and password text box values on home page. It is more like "this is what i entered while logging in". I see those values while going forward , and rightly so. But while coming backward too, i see those values. How is it possible. There have been many requests in between and each must have changed the request parameter value.
My question is that even though i click refresh, how does the browser "remember" my login parameters that i entered about 7 requests ago. I was under the impression that request parameters are valid for this request only. Then how come, when i traverse backwards, browser sends the request to server (up to here it is ok, since im pressing refresh, server will be hit), with the request parameters that i entered while logging in. I hope i am clear now.
I think your question is
How are you able to see the user and password on homepage after you refresh
The answer might be that you have used method type as GET and hence when you are refreshing you are effectively sending the same information which you would have previously sent from the login form.
I understand refresh will achieve that. I am using POST method to submit data from login form. But still your point is valid. I agree that i AM sending the data. But how come that data is saved after 8 requests.
Assume I login with "user" and "pass" values for username and password respectively. Assume these are valid values so on my home page i see : "you logged in with user and pass". It is fine up to here, I navigate further (example homepage-->page1--page2 )making NEW requests. Now i start coming back from page 2 using back button. Since I have forced no caching, i manually hit refresh to get each page from server.
I am at page 1 now and press back to see the home page. Since there is no caching, first i see "page expired". Then i hit refresh and see home page with message "you logged in with user and pass".
This is where i am stuck. Since the page is coming from server, how come these request values which were entered about 4 requests back, are coming from server. Where are they saved. I hope I am clear now.
when you are refreshing you are effectively sending the same information which you would have previously sent from the login form.
What does same mean here? The old information? Does browser keep track of HTML field values. Can you elaborate please.
Thanks for your reply.
Yes, the browser caches the form submission values as well as the URL.
In hindsight it appears a common sense stuff. I should have observed it, especially with that typical message where the browser asks the user if she wants to resubmit the form data.
Thank you for the peace my brain now feels.
subject: request parameters persisting across pages