change Dom element based on firebase admin value events

大兔子大兔子 提交于 2019-12-02 08:41:34

With servlets, your clients won't see any page updates until they send a new request to your application server. What you can do is get your ValueEventListener to update the state of an in-memory object. Then your servlet can read the latest state of that object whenever constructing the HTML output.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!