B4J Question Building web servers with B4J how create global variables

Roberto P.

Well-Known Member
Licensed User
how to create global variables in the web server? user code and other information to be saved for each transaction.


Active Member
Licensed User
You can create a global Hashmap variable and store any information for each session or to share any information on each request. Unfortunately, we don't have the possibility to create listeners on Jetty server and it will be good idea to add on the next version of B4x. Be careful, the variables need to be thread safe, because each handler is running on different thread and you cannot modify on the same time a common global variable.
Upvote 0


Staff member
Licensed User
Upvote 0