jsf-2primefaces-mobile

PrimeFaces Mobile requests undefined/undefined.css and undefined/undefined.js, causing JSF1064 warning and 404 error


When I add a <p:selectBooleanButton> to my PrimeFaces Mobile page, then I get the following warning in server log

WARNING: JSF1064: Unable to find or serve resource, undefined/undefined.css, from library, primefaces.
Jan 11, 2015 3:00:36 PM com.sun.faces.application.resource.ResourceHandlerImpl logMissingResource

and the following error in browser console:

404 (Not Found) http://localhost:8080/ewpmob/javax.faces.resource/undefined/undefined.js.xhtml?ln=primefaces&v=5.1.7

How is this caused and how can I solve it?


Solution

  • This is a bug in PrimeFaces mobile. This was discovered and fleshed out in the following related answer: Why is my p:progressBar not displayed, only the number?

    The workaround is, execute this script in end of head or begin of body, either inline or via a custom script file:

    var originalPrimeFacesCw = PrimeFaces.cw;
    PrimeFaces.cw = function(name, id, options, resource) {
        resource = resource || name.toLowerCase();
        originalPrimeFacesCw.apply(this, [name, id, options, resource]);
    };