Get typed text in textarea on autorefresh

I have used setHeader to set the refresh header. What happens is: i have a page with textarea when the user is typing in it and if the refresh happens i want the text to retain itself in text area. I am using only Servlets for the webapp.How can i achieve that.I have thought about partial page refresh

Is there any other solution. or if this is the solution how can i achieve that.

Yeah, this is the problem with auto-refreshes on a page where the user is expected to interact.

You will have to use JavaScript. You could do away with the refresh header and use JavaScript's timout() function to schedule an event. When triggered the event would read the contents of the text field, re-query the URL, adding any data if got from the text field as a parameter. The response would then take the URL parameter, put it into the text box and display the rest of the page.

The user would still see an interruption in his writing and would get annoyed. This was popular in the 90s, before it got replaced with pre-cursors of AJAX that used frames to do auto-refreshes and JavaScript to transport data across frames.

The alternative is to use AJAX, which is also JavaScript based, to asynchronously poll the server for information, and when it gets an update, change the portions of the page that need to be changed. AJAX is the most popular way of doing things like this recently.