Quick-n-Dirty: Control Dojo generation for individual XPages

Another interesting question has been asked on stackoverflow.com: How to enable or disable the Dojo libraries for individual XPages, not the whole application?

Just adding the parameter as shown below to the XPage won’t work:

<xp:this.properties> 
 <xp:parameter name="xsp.client.script.libraries" value="none" />
</xp:this.properties>

The workaround is to add a single line to beforePageLoad or beforeRenderResponse event:

facesContext.getRequestParameters().setJsLibrary(0);

The parameter can be set as the following

  • „0“ disables Dojo Framework
  • „1“ enables Dojo Framwork
  • „2“ enables Dojo Lite Framework

If you are using the ExtLib, there is still a problem with the automatically added CSJS libraries. These headers will be added automatically (it is the same result if you are disabling dojo application wide):

<script type="text/javascript">dojo.registerModulePath('extlib', '/xsp/.ibmxspres/.extlib');</script>
<script type="text/javascript" src="/xsp/.ibmxspres/.mini/dojo/@Eya.js"></script>

Edit:

This can only be removed by disabling the ressource aggregation or disabling the Extension Library for the whole application.

You can disable it f.e. by adding this to your XPage beforeRenderResponse event:

facesContext.getRequestParameters()
   .setProperty("xsp.resources.aggregate", "false")
Dieser Beitrag wurde unter ExtLib, Server, ServerSide JavaScript, XPages abgelegt und mit , , , , , , , verschlagwortet. Setze ein Lesezeichen auf den Permalink.

1 Antwort zu Quick-n-Dirty: Control Dojo generation for individual XPages

  1. Mark Leusink sagt:

    Interesting. Didn’t know/ realize that the facesContext object is an instance of the com.ibm.xsp.domino.context.DominoFacesContext class. I always assumed it was of javax.faces.context.FacesContext. That class has a whole lot of other interesting functions too!

Schreibe einen Kommentar zu Mark Leusink Antworten abbrechen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.