Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Update text area values without page reload

 
robin singal
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

How can i update textarea values without reloading the page. I want to pick up updated values from the database after 15-30 seconds & update text area. Is there anything in the servlets that i can use to update the textarea contents without reloading page. I am using only servlets for web application.

Thanks & Regards
Robin
 
Akhilesh Trivedi
Ranch Hand
Posts: 1603
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajax.
 
robin singal
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there nothing in the servlets that i can use to do this???
 
Akhilesh Trivedi
Ranch Hand
Posts: 1603
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are not hitting the server again, then you can think of pre-pushing the data (in request or session) and storing it in some javascript variable. After the time-out-calculation at client using javascript you can update the textarea with the javascript variable.
 
Soniya Ahuja
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Ajax... and it's not much that you need to do to change the values after 15-20 seconds. You'll find plenty of ready to use scripts on the net
 
robin singal
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am hitting the server to find the updated values.
It means there nothing in servlets that i can use to do the job....
I can only use Ajax for that.???

I just need to make sure that there is no solution for this using only servlet api.

Moreover is there anything that rmi(remote method invocation) can help me.

Thanks.

[ August 26, 2008: Message edited by: robin singal ]
[ August 26, 2008: Message edited by: robin singal ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Once the servlet sends its response to the browser, its job is done. Period.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to look up Pushlets. They are strictly just Servlets that don't close the output stream to the client, then as things on the server side change push more javascript commands to the client. Realistically there is an API to make using them easier.

See this article and search the web. They offer a call-back like alternative to the AJAX poll-type dynamic content.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34671
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Robin,
Well the AJAX will call a servlet so you aren't using it instead of servlets - more in addition to. Why don't you want to use AJAX?
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:
the AJAX will call a servlet so you aren't using it instead of servlets - more in addition to.


What Jeanne said.

AJAX is one of the most over hyped buzzwords in the history of the 'net. Its just HTML. Usually backed up with servlets or php or whatever server technology you want.

The basic HTTP RFCs do not allow updates without a server clank. All AJAX does is do the clanking in the background.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pat Farrell:
AJAX is one of the most over hyped buzzwords in the history of the 'net. Its just HTML.
Not HTML, just JavaScript.
 
robin singal
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

Originally posted by Jeanne Boyarsky:
Why don't you want to use AJAX?

My Senior told if possible use only Servlets

Thanks All for the useful info. As i don't know anything about Ajax i would do some research and would try to work out a solution with combo of (Servlet & java)

Best Regards
Robin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic