0

I have many clients that connect to a webservice. Everytime a client perform an action on the DB I want that all client can see the modify, by an updating of the jsp page that show the content of the DB. How can I do this in ajax?

valeriot90
  • 65
  • 7

2 Answers2

0

You can simply use websocket to refresh and renew page. use this link what to use websocket: Jsp+tomcat7.047+html5 simple demo based on websocket

-1

It is impossible by simply using ajax because the client (browser) don't know wwhen data is updated, and in client / server model, server can't send request to client to tell him.

Instead you should take a look at websockets. For example here : http://www.java2s.com/Tutorial/Java/0360__JSP/CreatingClientServerApplications.htm

Otherwise, you could simply refresh your web page by sending ajax requests periodically. If you are new to javascript, I recommand using jquery. The way to do it depends on your needs.

Sylvan LE DEUNFF
  • 682
  • 1
  • 6
  • 21
  • "Otherwise, you could simply refresh your web page by sending ajax requests periodically." How can I do this? – valeriot90 Dec 12 '18 at 13:54