wood burning stoves 2.0*
The moose likes Servlets and the fly likes Get typed text in textarea on autorefresh Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Get typed text in textarea on autorefresh " Watch "Get typed text in textarea on autorefresh " New topic
Author

Get typed text in textarea on autorefresh

robin singal
Ranch Hand

Joined: Jul 18, 2007
Posts: 102
Hi

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.

Thanks.


Life is short play hard.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4164
    
  21

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.


Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Get typed text in textarea on autorefresh
 
Similar Threads
how can i do this in javascript?
How to focus last line in the textarea
how to apply css style to particular words in text area
Positioning the scroll bar..
A stange error while storing single quote in a table