2

I am working on a mobile application using XPages. I am trying to speed things up by caching ressources locally on the device. That is not a simple task using the controls in the Extension Library (e.g. I have typeahead on some of the pages).

Therefore, I have decided to build a parallel interface using jQuery Mobile to be able to benchmark the two approaches.

In doing this I would like to handle the ressource for the jQuery Mobile XPage so that I only load the ressources needed, i.e. avoid loading dojo (there is a short guide e.g. on this page: http://dpastov.blogspot.dk/2011/01/trying-to-get-full-control-over-xpage.html). The problem with the solutions I have found is that they are application wide. E.g. setting

xsp.client.script.libraries=none

in xsp.properties will take effect for all of the XPages in the database (including the Ext.lib version of the app.). Following the guide in the "XPages Portable Command Guide", I have tried to set the property for the individual XPage (the jQuery Mobile one) as:

    <?xml version="1.0" encoding="UTF-8"?>
    <xp:view xmlns:xp="http://www.ibm.com/xsp/core" disableTheme="true" createForm="false">
        <xp:this.properties>
            <xp:parameter name="xsp.client.script.libraries" value="none">  
            </xp:parameter>
        </xp:this.properties>

Unfortunately, this does not seem to work.

I know, that I could put the second XPage in a separate database, however, I would like to avoid that since that raises other issues.

Any ideas?

/John

2 Answers 2

4

You can disable the dojo libraries by adding

facesContext.getRequestParameters().setJsLibrary(0);

to beforeRenderResponse or beforePageLoad event of your XPage.

0
0

using a secondary database for your jQuery design sounds reasonable. What you should do then is load the UI from the secondary database and use ajax calls to (a) ajax/rest control(s) in the primary database. You could also load your UI from resources or classic pages (set to passthru HTML).

Clarification of options (each bullet is a separate approach):

  • use a secondary database (the least desirable)
  • put the initial jQuery UI (sans actual data) into a classic page and load the data using a REST call from a JSON control (from extlib) that sits on an XPage
  • load the initial jQuery UI using an XAgent and proceed using REST/JSON for populating data

Hope that helps

3
  • Hi Stephan Well, as mentioned, creating a second database just to host one or two XPages seem a little overwhelming. Therefore, I would have hoped to be able to have both "models" in the same database (making deployment in development, test, and production environments simpler). A thing that springs to mind - not testet yet - is to disable Dojo for the entire application, and then if possible just load it explicitly for the XPages that use the traditional approach. I have also considered using ordinary pages, however, I would prefer to have the superior capabilities of XPages at hand ;-) Oct 15, 2012 at 20:36
  • When you build your whole mobile UI on jQuery, you don't need much XPages power for this - so loading the initial UI from a page would actually be sufficient. The trick then is to use the REST control from the extlib to feed the data into your UI. And there you have the full power of all of the XPages.
    – stwissel
    Oct 16, 2012 at 1:29
  • I agree with your approaches. For the jQuery UI I still use (and would prefer to use) the controls of the XPage to show/hide elements, calculate values, etc. However, my question was about the ability to control the loading of Dojo ressource for a single XPage. Is the conclusion that we cannot control this along the lines mentioned in the XPages Portable Command Guide - or in any other way? Oct 16, 2012 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.