dominoGuru.com

Your Development & Design Resource

IBM XPages Developers: Do you get the full URL from your XSPUrl?

Sometimes it's finding out what the problem actually is that's the biggest key to finding the solution.

I spent some time today writing an article on using URL fragments to create anchor tags in tabbedPanel Control-based XPages applications... only to find that the XSPUrl's getFragment() method wouldn't return the actual fragment from the URL.

Or, in other words...

When I hit http://dominoguru.com/demo/sxt.nsf/demo_XSPUrl.xsp?open#foo, I can't get a handle on #foo via the SSJS method designed to do that very thing!

From the Domino Designer Help Database:

Usage
The fragment identifier follows the # character after the URL proper and identifies a location in the URL content.

Source

No matter how many times I try it... I get nothing. But I don't think the problem has anything to do with the getFragment() method.

First, I put together a simple demo XPage, with a single computed text Control:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view
    xmlns:xp="http://www.ibm.com/xsp/core"
    pageTitle="XSPUrl Check">

    <xp:text
        tagName="h2"
        style="margin: 25px;"
        value="#{javascript:context.getUrl().toString()}">
    </xp:text>

</xp:view>

From there, I started hitting some variants of the URL:

Test URL Syntax Result
Simple URL demo_XSPUrl.xsp Click Here
QueryString Parameters demo_XSPUrl.xsp?blah=foo Click Here
Simple URL with Fragment demo_XSPUrl.xsp#foo Click Here
QueryString Parameters with Fragment demo_XSPUrl.xsp?blah=foo#foo Click Here

So... it's the XSPUrl that's broken?!

XSPUrl Y U in Production?!

I tested this in 8.5.1 and 8.5.2 (with 8.5.3 testing coming later tonight), and got the same results. What do you get? Let me know in the comments on this post. Perhaps (and quite frankly, I hope this is the case) I'm the only one seeing this... and there are certainly workarounds that we can employ... but knowing limitations like this are extremely important!


About the author: Chris Toohey

Thought Leadership, Web & Mobile Application Development, Solutions Integration, Technical Writing & Mentoring

A published developer and webmaster of dominoGuru.com, Chris Toohey specializes in platform application development, solutions integration, and evangelism of platform capabilities and best practices.



More from dominoGuru.com


dominoGuru.com is powered by IBM Notes Domino XPages & hosted by Prominic.NET

Contact Us

Use our Contact / Feedback form or one of these email addresses:

Creative Commons License

Except where otherwise noted, dominoGuru.com by Chris Toohey is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.