|
articles tutorials screenshots home forums downloads bugs mailing list |
Kalideoscope Zone - knowledge base
Passing parameters to pages There are numerous ways of sharing data between pages within the XUI platform. Bindings can be used to persist data to the XModel structure which can be used throughout the application. Another method is to use library functions as outlined in a previous knowledge base article here In this article we will be passing parameters to XPage objects with use of the setAttribute and getAttribute functions. We'll start with creating the a start page called Welcome as shown in Listing 1
Listing 1 - The welcome page declaration
The class attribute of the page declaration shows that the net.xoetrope.pagetest.Welcome class is being used for the page and this class is shown in Listing 2.
Listing 2 - The Welcome XPage class
The next function begins by calling the loadPage function of the XPageManager in order to load the page2 page. Next the setAttribute function of the XPage is called with the name param and with the value of the page text component. Finally the page2 XPage is shown by using the showPage function. The page2 declaration can be seen below in Listing 3
Listing 3 - The page2 XML declaration
The net.xoetrope.pagetest.Page2 class can be seen below in Listing 4
Listing 4 - The Page2 class
The page2 class uses the pageActivated method of the XPage class in order to retrieve the parameter by using the getAttribute function. Any Object can be passed between pages in this way. In order to illustrate this the page shown in Listing 5 sets up items in a Vector and passes it to another page.
Listing 5 - Passing a Vector Object to an XPage
And the Vector is retrieved and used as shown in Listing 6
Listing 6 - Retrieving and using the Vector
Files
You need to be logged in to download the files for this article
comments If you were logged in you could rate this article or add a comment. |