It is possible to pass context information, such as the name of a screen, to a FreeMarker template and/or a Groovy script directly from the Screen widget definition.
Context information can be passed to FreeMarker in the following way:
actions
element within a Screen widget definition, add one/more set
elements with the field
attribute set to the name of the variable and the value
attribute set to the value of the variable.Setting field
values using the earlier method places the named variable with its value within the execution context. Once in the context, the FreeMarker rendering engine and any other screen rendering artifact, including any OFBiz widget, has access to it.
For example, to add an action to set a context variable named myScreenVariable
, you might code something like the following:
<actions> <set field="myScreenVariable" value="aValue"> </actions>
Within FreeMarker, you may access this value as follows:
<#assign localVariable = myScreenVariable>
To retrieve this value using Groovy:
localScreenName = context.myScreenVariable;
3.137.174.23