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

自闭症网瘾萝莉.ら 提交于 2019-12-23 13:16:36

问题


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?


回答1:


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]);
};


来源:https://stackoverflow.com/questions/27884834/primefaces-mobile-requests-undefined-undefined-css-and-undefined-undefined-js-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!