Hey Bruce,
It's all about getting the syntax down.
For dominoDocument and dominoView data sources, the databaseName uses the following syntax:
servername!!directory\subdirectory\db.nsf
Now, you only need the "servername" and the double-exclamation separators if your target Domino server is remote/external to the one serving your XPage.
In other words, if you're XPage is on "DominoServer1" and want to access a NotesDatabase on "DominoServer2", the databaseName would be:
DominoServer2!!db.nsf
If your XPage is on "DominoServer1" and you want to access a NotesDatabase on "DominoServer1", the databaseName would be:
db.nsf
Once you get this down, you can do some pretty cool things. For example, you can allow your users to "select a data source" via a combobox on your XPage, and have either the dominoDocument or the dominoView databaseName point to the combobox value.
Here's a quick example of a single XPage (Home.xsp) that has dynamic dominoDocument and dominoView databaseNames that point to two external databases. This XPage can point to two different NotesDatabase data sources (ds1.nsf & ds2.nsf) for creating or reading NotesData. Here's the XSP markup:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core">
<xp:div
id="actionbar">
<xp:comboBox
id="database"
value="#{sessionScope.database}"
defaultValue="demo\ds1.nsf">
<xp:selectItem
itemLabel="Data Store 1"
itemValue="demo\ds1.nsf">
</xp:selectItem>
<xp:selectItem
itemLabel="Data Store 2"
itemValue="demo\ds2.nsf">
</xp:selectItem>
<xp:eventHandler
event="onchange"
submit="true"
refreshMode="partial"
refreshId="container_data">
</xp:eventHandler>
</xp:comboBox>
</xp:div>
<xp:div
id="container_data">
<xp:panel
id="panel_newdocument">
<xp:this.data>
<xp:dominoDocument
var="newdocument"
databaseName="#{javascript:getComponent('database').getValue()}">
</xp:dominoDocument>
</xp:this.data>
<xp:table>
<xp:tr>
<xp:td
styleClass="label">
<xp:label
for="title"
value="Title" />
</xp:td>
<xp:td
styleClass="input">
<xp:inputText
id="title"
value="#{newdocument.title}" />
</xp:td>
</xp:tr>
<xp:tr>
<xp:td
styleClass="label">
<xp:label
for="description"
value="Description" />
</xp:td>
<xp:td
styleClass="input">
<xp:inputTextarea
id="description"
value="#{newdocument.description}" />
</xp:td>
</xp:tr>
<xp:tr>
<xp:td
colspan="2"
styleClass="action">
<xp:button
value="Submit"
id="submit_newdocument">
<xp:eventHandler
event="onclick"
submit="true"
refreshMode="complete"
immediate="false"
save="true">
<xp:this.action>
<xp:openPage
name="/Home.xsp"></xp:openPage>
</xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:td>
</xp:tr>
</xp:table>
</xp:panel>
<xp:viewPanel
rows="30"
id="viewPanel1">
<xp:this.facets>
<xp:pager
partialRefresh="true"
layout="Previous Group Next"
xp:key="headerPager"
id="pager1">
</xp:pager>
</xp:this.facets>
<xp:this.data>
<xp:dominoView
var="view_documents"
viewName="documents"
databaseName="#{javascript:getComponent('database').getValue()}">
</xp:dominoView>
</xp:this.data>
<xp:viewColumn
columnName="created"
id="viewColumn1">
<xp:viewColumnHeader
value="created"
id="viewColumnHeader1">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn
columnName="title"
id="viewColumn2">
<xp:viewColumnHeader
value="title"
id="viewColumnHeader2">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn
columnName="description"
id="viewColumn3">
<xp:viewColumnHeader
value="description"
id="viewColumnHeader3">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn
columnName="author"
id="viewColumn4">
<xp:viewColumnHeader
value="author"
id="viewColumnHeader4">
</xp:viewColumnHeader>
</xp:viewColumn>
</xp:viewPanel>
</xp:div>
</xp:view>
Now, this is a very basic example (and quite ugly too - I didn't take the time yet to style it, nor clean up the viewPanel, etc.), but it'll give you an idea of what you can do with dynamic dominoDocument and dominoView data sources.
If you have any problems with this, please let me know!
-Chris
http://www.dominoGuru.com