global variable for a project.

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

global variable for a project.

#1

Postby xren » Tue Feb 19, 2013 9:44 pm

Hi

I would like to share some information among all sessions for a specific project. Is there a way to do that?

For the environment variable defined in the deployment xml is that shared by all projects?

Thanks,
Xiaoli
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Wed Feb 20, 2013 5:23 pm

You do this by adding attributes to the web application context. These attributes are then available to all users e.g.

to set:

Code: Select all

client.httpSession.servletContext.setAttribute("ATTR1", "Hello World");
to read:

Code: Select all

var attr1 = client.httpSession.servletContext.getAttribute("ATTR1");
You only really need to do this if the attribute value is dynamic. If it's static, it's probably better to use environment variables. See Ebase standard documentation for details of using environment variables.
0 x


Who is online

Users browsing this forum: No registered users and 31 guests