Opening another XPage

From an XPage, users can open other XPages through navigation rules, a simple action, XSPContext methods, and opening the URL.

Navigation rules

Each XPage has a navigationRules property which is an array of navigationRule elements. A navigation rule tells the server which page to return to the client after processing a page submitted through a button of type Submit or Cancel. See button - Button. Each navigation rule has the following attributes:
attribute value
outcome xsp-success if the update is normal
xsp-failure if the update fails
redirect true means restore the last state of the page
false (default) means open a clean page
viewId <no rule> means open the same page
$$PreviousPage means open the page last opened before the submitted page
$$HomePage means open the launch page
page.xsp means open a specified page
Here's an example:
<xp:this.navigationRules>
	<xp:navigationRule
		outcome="xsp-success" viewId="$$PreviousPage">
	</xp:navigationRule>
	<xp:navigationRule
		outcome="xsp-failure" viewId="/errpage.xsp">
	</xp:navigationRule>
</xp:this.navigationRules>

In Design mode, click outside all controls, click the XPage tab, and look for the Next page options.

Simple action openPage

The Open Page simple action (see the HCL Domino® Designer XPages Reference) opens a page immediately upon activation. Here's an example:
<xp:button value="Open page 2" id="button4">
	<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
		<xp:this.action>
			<xp:openPage name="/xpage2.xsp"></xp:openPage>
		</xp:this.action>
	</xp:eventHandler>
</xp:button>

XSPContext methods for redirecting

The redirectToPage (see the HCL Domino® Designer XPages Reference), redirectToPrevious (see the IBM® Domino® Designer XPages Reference), and redirectToHome (see the IBM® Domino® Designer XPages Reference) methods open a page immediately upon activation. Here's an example:
<xp:button value="Open page 2" id="button4">
	<xp:eventHandler event="onclick" submit="true"
		refreshMode="complete">
		<xp:this.action>
			<![CDATA[#{javascript:context.redirectToPage("xpage2.xsp")}]]>
		</xp:this.action>
	</xp:eventHandler>
</xp:button>

Opening the URL

You can open a page by sending its URL to the server. For example, you might specify the following in the address window of a browser:
http://myserver/foo.nsf/xpage1.xsp

From a non-XPage design element, you can use @URLOpen in a formula. The following formula is for a form action and opens an XPage locally in the Notes® client:

@URLOpen("notes:///foo.nsf/xpage1.xsp?OpenXpage")