Keep form's data on browser's back or forward
The problem that I have is that some browsers loses data, when a user hits back or forward. Firefox for example, most of the times, loads from cache, so it's OK, but Chrome reinits the form every time!
I am now keepin开发者_JAVA技巧g the data in a cookie and load them back. But it's not only one form and the forms are big and sometimes, the cookie's size is not enough. Couldn't find any other way to do this...
Can you suggest me something and help me solve this?? Thanks in advance.
You can try session variable. Value of cookies are stored in client side cookie folder, but Session data stored in client side. It is more light weight then cookies.
You could use AJAX to send the values to your server (perhaps on an interval, or before a page unload), store them in the session, and retrieve them with AJAX when the user goes back to the form.
what could be done is as follows . In your HTML page make sure you set the HttpSessionvariable true . This can be done by the following
<% HttpSession ses = request.getSession(true);
// ses.sesAttribute or ses.getAttribute can be used
%>
精彩评论