• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Get typed text in textarea on autorefresh

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic