Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: MVC in Ajax

  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    MVC in Ajax

    Was wondering how you implement MVC easily using Ajax. I have a backend servlet that does processing and acts as the controller but I want the frontend to be html/javascript/jsp and receive updates from the controller as a view. For example if one client updates the view the servlet controller will process the event and update the view for all other clients which are looking at the same view. This becomes a problem because the servlet can only react to http requests and if the controller wants to update the frontend at a random point in time it can't. Is there a way to listen to events on the backend using the frontend Javascript - to me it seems unlikely as it would have to establish a TCP connection at any point in time to the client but how would this be done normally? Essentially I want to be able to update html elements on a page depending on some remote event? Ideally I don't want to keep polling the servlet with requests.

    Thanks for the help.

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    967
    Thanks
    19
    Thanked 211 Times in 209 Posts
    Quote Originally Posted by alex.p View Post
    Essentially I want to be able to update html elements on a page depending on some remote event? Ideally I don't want to keep polling the servlet with requests.

    Thanks for the help.
    http://en.wikipedia.org/wiki/WebSocket

  • Users who have thanked DaveyErwin for this post:

    alex.p (12-13-2011)

  • #3
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks definitely look into that . Hmm do you know of any frameworks that wrap around WebSockets as it seems quite low level I'm guessing there won't be too many as it's still a work in progress but just thinking if there's easy object support and Java integration.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •