0

When customer makes a deposit, this inserts a request in the database. When this happens, I want send an alert or play an alarm on a separate jsp (admin page containing list of approvals). Any ideas?

Inigo
  • 1
  • 1
  • 6
  • alarm means notifications ? have a look at [this question.](http://stackoverflow.com/q/16010701/4290096) – Arun Xavier Mar 23 '16 at 04:19
  • Regarding websockets, if I send a message using a different session, my admin session should instantly get the message as long as my socket is open, right? – Inigo Mar 23 '16 at 05:16

2 Answers2

0

In case anyone is interested, I solved this by creating a polling function that runs on the header that sits on all pages via tiles framework.

var alert = document.createElement('audio');
var count2 = $.cookie('list');
function poll(){
  setTimeout(function(){
    $.ajax({
        url: url
        ,type: "GET"
        ,success: function(data){
            var count1 = data.info;
            if(count1>count2){
                count2 = count1;
                alert.play();
                $.cookie("list",count2,{path:'/'});
                $("#approvalCount").html($.cookie("list"));
            }else if(count1<count2){
                count2 = count1;
                $.cookie("list",count2,{path:'/'});
            }
        }
        ,dataType: "json"
        ,complete: poll
        ,timeout: 2000
    })
}, 30000);

};

Inigo
  • 1
  • 1
  • 6
0

Once its inserted write a script to display an alert:

out.println("<script><script>alert('Value Got inserted successfully')</script>");

OR you can do it like this aswell:

%><script>alert("Value Got inserted successfully")</script><%
bofredo
  • 2,348
  • 6
  • 32
  • 51