Page attributes are parameters that are declared explicitly for one page. You can access page attributes from the layout and from all event handlers. You use page attributes to store data that is determined in the event handler OnInitialization, and you can use the page attributes to make the data accessible to layout processing and the remaining event handlers.
Access to the contents of the page attribute is not, however, given automatically at any time. If, for example, you fill an internal table in OnIntialization that you have defined as a page attribute, although this definition is known in OnInputProcessing, the table contents is not known if you are working in stateless mode. Additional information is described below.
There are two types of page attributes:
Automatic Page Attributes
If you mark a page attribute as ‘automatic’ (auto in the system), the attribute automatically gets its values via the calling URL or via the navigation process from other pages. This kind of attribute only has to be declared for one page. It is identified by its name equivalence. If another page uses a parameter with the same name, at runtime that parameter automatically gets the same values as the attribute.
navigation -> set_parameter(name = 'FLIGHT' value = 'LH' )
Let us assume that you have defined
FLIGHT as an automatic page attribute and assigned it a value from the navigation process.Possible Types for Automatic Page Attributes
Before SAP Web Application Server 6.10, auto page attributes could only have the type
STRING.Now, other types are available:
If
<input type=text name="myaddress.firstname">
myadresses[i].firstname
allows you to specify the first name in question in the line of the table represented by ‘i’, that is, if i=6, the first name used in line 6 of the table is being referred to.Non-automatic page attributes
If you flag a page attribute as non-automatic, the attribute gets its values from the class attribute.
Transferring Parameters Between Pages: Visibility of Page Attributes
The visibility of page attributes when parameters are transferred between BSP pages depends on whether the navigation is explicit or implicit.
For example, if
In explicit navigation, the page object is always reinstantiated. When the page object is being reinstantiated, in both stateful and stateless mode, the attributes with
navigation->set_parameter must be transferred to auto page attributes of the same name, so that the values that were set are not lost.User input triggers the sending of a request. Because no explicit navigation has been provided, the same page is run again.
With implicit navigation, the page attributes are transferred automatically from OnInputProcessing to OnInitialization, both in stateful and stateless mode.
The auto page attributes are refilled by the request, both in stateful and stateless mode.
The difference is that, in stateful mode, any non-auto page attributes that may have changed retain the changed value, whereas in stateless mode, the values are reset to the original values. This is because the page instance stays ‘alive’ in stateful mode, but is reinstantiated in stateless mode.
Lifetime of Page Attributes
When you navigate between pages, there are the following cases of different lifetimes for automatic and non-automatic page attributes:
Lifetime of attributes remaining on the same page
No navigation takes place.
Attribute Type |
Value in Request (Example Value) |
Value in OnInputProcessing |
Explicit Transfer |
Value in OnInitialization |
automatic |
SAP |
SAP |
No |
SAP |
automatic |
SAP |
SAP |
Yes |
SAP |
Non-automatic |
SAP |
No |
SAP |
|
Non-automatic |
SAP |
Yes |
SAP |
Lifetime of attributes with navigation to the same page
The navigation object is used (
navigation->goto_page(samepage.htm)) to navigate to the same page.
Attribute Type |
Value in Request (Example Value) |
Value in OnInputProcessing |
Explicit Transfer |
Value in OnInitialization |
automatic |
SAP |
SAP |
No |
|
automatic |
SAP |
SAP |
Yes |
SAP |
Non-automatic |
SAP |
No |
||
Non-automatic |
SAP |
Yes |
Lifetime of attributes with navigation to a different page
The navigation object is used (
navigation->goto_page(otherpage.htm)) to navigate to a different page.
Attribute Type |
Value in Request (Example Value) |
Value in OnInputProcessing |
Explicit Transfer |
Value in OnInitialization |
automatic |
SAP |
SAP |
No |
|
automatic |
SAP |
SAP |
Yes |
SAP |
Non-automatic |
SAP |
No |
||
Non-automatic |
SAP |
Yes |