Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Push technology in servlet.

 
Girish Gopal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to implement push technology in servlet?
I have an application scope variable say 'a'. which is viewed and edited
through a text box in jsp page. What I need is change made to the variable
'a' should get reflected in all the browsers who view the value of 'a'

I want the server to intimate to the clients who sees the value of
variable 'a'.

Thanks,
Girish
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

HTTP has a "client request -> server response" model that makes it tricky to simulate server push.

If this was my problem I'd have all clients that are interested in updates query the server through JavaScript/AJAX every minute or so. Using a library like Prototype makes this real easy.
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at http://pushlets.com/ it may help you.
 
Girish Gopal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for your reply Dittmer and Sudhir.

Yes I have implemented it in ajax..where the client does a refresh in time intreval..

But was interested to know whether it could be done from server end..


Again thanks a lot..
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It may be a Late Reply

But it is also possible to do it from the Server End , check whether there is any Listener associated with the Context i mean application
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RaviNada Kiran wrote:But it is also possible to do it from the Server End , check whether there is any Listener associated with the Context i mean application

What do listeners have to do with this? If there's no connection to the browser, then there's nothing the server can do about that.
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry , wrongly posted
 
Sandeep Kumar Jakkaraju
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fellow JSP/Servlet programmers

There is a header which takes time as parameters and does a auto-refresh !!!
When the variable is application scoped you just need to refresh the page or the servlet right !!!
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTML has the meta refresh tag. Its a bit more disruptive than using the AJAX solution mentioned earlier though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic