Portlet Factory, Version 6.1.2


 

Variables with WebAppAccess

Variables are used to store data for an instance of a running WebApp, much the way class members are used in Java. Variables can be created at WebApp generation time or at runtime, once created they can be read or updated using the Variables interface API. Here is an example of creating a new variable:

Variables variables = webAppAccess.getVariables(); Variable variable = variables.addVariable("MyNewVariable",Variable.TYPE_STRING); variable.setValue("Test Data");
Here is an example of getting the value of a string value:
String data = webAppAccess.getVariables().getString("MyNewVariable");
Here is an example of setting the value of a string value:
webAppAccess.getVariables().setString("MyNewVariable", "New Test Data");

Parent topic: WebAppAccess


Library | Support |