XPages Tip: Workaround for Broken Custom Links on the Application Default Page

If you have any kind of data display control with a custom document open link set as the default launch page for the application, the links may not work. In this post, I’ll show a simple workaround.

For example, I have an application where the default launch page included a Data View with a customized summary section that included a link like this:

"<a href='MyPage.xsp?action=openDocument&documentId=" + viewEntry.getDocument().getUniversalID() + "'>OpenDocument</a>"

However, it doesn’t work when the application is launched. If the user opens the application with a link that only includes up to the nsf (such as http://www.MyDomain.com/MyDatabase.nsf), the link shown above will try to open the page without the database in the url (such as http://www.MyDomain.com/MyPage.xsp?action=openDocument&documentId=unid).

This is a minor issue, but it is something that needs to be accounted for.

One option is to code the link to check the current URL and adjust the generated link accordingly.

Another option is to create a separate “home” page as the application’s default page to launch in the browser and have the page redirect to whatever you want the default page to be, thus ensuring that the page name is always in the URL. Set the new page as the application default and have that page and route to the full page, by putting this code on the beforePageLoad event:


Of course, this being XPages, there are sure to be numerous other solutions.

How have you worked around this issue?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: