The key difference between XPages and previous Lotus Notes/Domino design elements is that XPages free application developers from the "one document at a time" design box. Before XPages, Notes/Domino application users could look at a single document (form) or a list of documents one line at a time (view). But it was difficult or impossible to interact with data from more than one document or database. DbLookups and PostSave events were available, but they can be awkward and aren't permitted in some instances.
XPages allow designers to present Lotus Notes/Domino users with the data they need to see and modify, regardless of how the data is stored. In addition to breaking the one-document paradigm, XPages contain numerous options and are very powerful.
Before diving into the details, keep in mind the following:
- Xpages are included in Domino 8.5 and Domino Designer 8.5, but not earlier versions.
- XPages are visible only via the Domino Web browser interface. Your Domino server must be running the HTTP task and you cannot use XPages in a Notes client application.
- To run an XPage, you must change the server's default security settings. Go to the server's names.nsf -> Configuration -> Servers -> All Server Documents -> <your-server> -> Security -> Sign agents or XPages to run on behalf of the invoker. Add the name of the person who last saved the XPage. In our example, that will be you.
To look at a sample XPage, download this example and unzip the two .NSF files. Place those files into the data directory of a Domino 8.5 server and open xpages1.nsf with Domino Designer 8.5.
Within Domino Designer, go to the XPages category for the database. You will see one XPage named XPage1. Double-click on XPage1 to open it. Within XPage1, there is some plain text and two embedded view controls. Next, follow these steps:
- Click in the upper-left corner of the first view control to select the entire control.
- In the lower portion of the screen, select the Properties tab, then the Data sub-tab.
This panel controls what data appears in the view control. Note that it references a view in this database named View1.
- Click on the left-hand column of the view control, then look at Properties -> View Column. This column displays the plain text value of the data.
You can also see that the column can be set to display a link to the underlying document, allowing the user to click on the display and open the document.
Note: This sample is missing some additional features needed to work fully.
- Scroll down to the second view control, click in the upper left corner to select the entire control and choose Properties -> Data.
- This view control displays View1 from the other sample database: xpages2.nsf.
- Use the database picker button to change the server name for xpages2.nsf from my server's name to yours.
- Save and close XPage1. Be sure to save it under an ID that matches the security setting mentioned above.
Next, look at the databases with Lotus Notes 8.5.
- Open each database. Notice that it contains a single view, single form and a short list of documents.
- Examine the launch property of xpages1.nsf. To do so, right-click -> Application -> Properties -> Launch tab. Notice that the browser launch is set to use XPage1.
Finally, run the full sample from a Web browser to see your newly created XPage in action.
- In the browser address bar, enter http://nnn.nnn.nnn.nnn/xpages1.nsf , where nnn.nnn.nnn.nnn is the IP address or name of your test Domino server.
- You should see that xpages1.nsf opens directly to the XPage that you examined and that it displays two views -- one from each database.
Although this example is quite simple and does not include features to combine multiple documents or modify data, it provides a decent framework that you can experiment with and modify.
As Domino Designer 8.5 displays an XPage, all of the controls available to the developer are shown along the right-hand side of the screen. You can modify my basic example with these controls to perform additional operations.
|ABOUT THE AUTHOR:|
Chuck Connell is president of CHC-3 Consulting, which helps organizations with all aspects of Domino and Notes.
This was first published in June 2009