My way to use it would be with javascript setInterval() along with a jQuery AJAX call to receive notifications. in the document is ready, call this (in jsp): setInterval(callMe, 30000)
in the JS file:
function callMe(){ ... $.ajax({ type: "GET", url: "ajaxNotifications", success: function(count){ alert( "You have: " + count + "notifications now" );
and finally in the Spring controller:
@RequestMapping(value="/ajaxNotifications", method = RequestMetho.GET) public @ResponseBody String getMeCount(HttpServletReuest req, HttpServletRespones resp){
Hope this gives you some idea or helps someone else find the answer to this question. :)
source share