Setup: JSF, PrimeFaces 3.2, Omnifaces 1.1, JBoss AS 7.1.1, Final, Mojarra 2.1.7
I have a simple page (listed below) and I have set up omnifaces to deal with ViewExpi
This is a known issue of PrimeFaces update="@all"
in IE based browsers. The entire view is been replaced by document.write()
, however IE based browsers doesn't properly load/initialize any <script>
resources. See also this PrimeFaces forum topic. This will be addressed for PrimeFaces version 3.4.2.
Until then, you can workaround it using the following JavaScript
var originalPrimeFacesAjaxResponseFunction = PrimeFaces.ajax.AjaxResponse;
PrimeFaces.ajax.AjaxResponse = function(responseXML) {
var newViewRoot = $(responseXML.documentElement).find("update[id='javax.faces.ViewRoot']").text();
if (newViewRoot) {
$('head').html(newViewRoot.substring(newViewRoot.indexOf("<head>") + 6, newViewRoot.indexOf("</head>")));
$('body').html(newViewRoot.substring(newViewRoot.indexOf("<body>") + 6, newViewRoot.indexOf("</body>")));
}
else {
originalPrimeFacesAjaxResponseFunction.apply(this, arguments);
}
};
which needs to be loaded after PrimeFaces own JS resources; this can be done by referencing it in <h:body>
with target="head"
.
<h:body>
<h:outputScript name="script.js" target="head">
...
</h:body>
Note that this assumes that the current view is using PrimeFaces components which should in turn force auto-inclusion of primefaces.js
and jquery.js
scripts. Otherwise you've to manually declare them.