change Dom element based on firebase admin value events

前端 未结 2 955
鱼传尺愫
鱼传尺愫 2021-01-28 03:37

I have a simple HTML page printed out inside a Servlet. Here I have setup firebase admin sdk and have set a value event listener for a path.

When the events fire, I wish

2条回答
  •  不知归路
    2021-01-28 04:10

    So i managed to solve this using a JSP instead of a Servelet.

    In either case, the solution was to tranfer all the logic to a JavaScript function. Then calling the said function on body load.

    onload=callthefunction()
    

    The firebase listeners were converted from java to the JavaScript version:

    on()
    off()
    

    This way there is need to call ajax or anything and the elements that need to be changed can be directly altered from JavaScript

提交回复
热议问题