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?