Search code examples
xpagesxpages-ssjs

read in properties on beforepageload


I would like to read a value from a properties file in the beforepageload event. unfortunately I load the properties file as a variable via a theme but ofcourse this does not work because it is not available yet.

Is there anoter way to read in the file via SSJS ?


Solution

  • You can add the properties file as a "bundle" to the XPage's resources:

    <xp:this.resources>
        <xp:bundle src="/XYZ.properties" var="XYZ"></xp:bundle>
    </xp:this.resources>
    

    and directly get any of its property values with:

    var propvalue = XYZ.propkey;