This follows on from two previous articles where I outlined what became evident from the oneui themes, ways to reference server-based resources from XPages. Those articles (Part One and Part Two) concentrated on images, the most useful resource.
Like many developers, at Intec we have a suite of databases with resources (some images, css files, script libraries etc) residing in a single database. When referencing resources, if you prefix the database path with “/” the output HTML is prefixed with the current database path as well. This resulted in me using SSJS to get the full host name and protocol (“http” or “https”), not a pretty or good-practice way of doing it.
Today, when challenged by one of my colleagues, I finally put two and two together and realised that by using “/.ibmxspres/domino” I get to the data folder, from which I can navigate to sub-folders. (At times I can be rather slow!) So instead of referencing the protocol and host name, I can use “/.ibmxspres/domino/” + the database path to reference another database on the same server.