Creates a context global variable#include <smuweb.h>int sm_web_save_global(char *variable_name);
- Name of the JPL global variable to be designated as a context global.
sm_web_save_globaldesignates a JPL global variable as a context global. Each context global is private to a single user of a Web application server and is automatically cached until it reverts to a transient global or the application exits. Before calling this function, create the global variable with the
A context global can save user-specific information such as ID, preferences, or start time. The value of the variable is cached before Panther generates the HTML for the screen; the value is restored from the cache file when the screen is submitted back to the server.
globalcommand executes a second time, it overwrites the global's previous value. If you execute the
globalcommand in the unnamed JPL procedure or during screen entry, also test whether the screen is being opened for a
GETevent, because the screen is then reopened on a
POSTevent. You can test this by using the
K_WEBPOSTflag or the CGI variable
For more information about using JPL global variables in a Web application, refer to Chapter 7, "JPL Globals in Web Applications," in Web Development Guide.
// Call on application startup.
// Create global variables if they do not already exist.
if (sm_web_save_global("pref_lang") < 0)
global pref_lang(15), pref_textonly(1), pref_maxrows(1)
// Initialize the preferences to the default values.
pref_lang = def_lang
pref_textonly = def_textonly
pref_maxrows = def_maxrows