Search code examples
ajaxinternet-explorerjsf-2myfaces

myfaces+ajax+IE - problems on page loading


After I added f:ajax tag to one of my pages, tomcat automatically inserted jsf.js script into header:

<script type="text/javascript" src="<app-name>/javax.faces.resource/jsf.js.jsf?ln=javax.faces&amp;stage=Development">

it started causing some weird errors in IE on page loading. Most amazing is that each time page is reloaded the number of errors and places they occurred may differ, sometimes significantly. Should I mention that in Chrome everything loads without any problems?

    SCRIPT5007: Unable to get value of the property '_mfClazz': object is null or undefined 
jsf.js.jsf?ln=javax.faces&stage=Development, line 734 character 13
SCRIPT5009: '_MF_OBJECT' is undefined 
_HtmlStripper.js.jsf?ln=org.apache.myfaces.core.impl.util, line 28 character 1
SCRIPT5009: '_MF_OBJECT' is undefined 
_AjaxUtils.js.jsf?ln=org.apache.myfaces.core.impl.xhrCore, line 27 character 1
SCRIPT5007: Unable to get value of the property 'engine': object is null or undefined 
Xhr1.js.jsf?ln=org.apache.myfaces.core.impl.xhrCore, line 29 character 1
SCRIPT5009: '_MF_OBJECT' is undefined 
_Queue.js.jsf?ln=org.apache.myfaces.core.impl.util, line 25 character 1
SCRIPT5007: Unable to get value of the property '_mfClazz': object is null or undefined 
jsf.js.jsf?ln=javax.faces&stage=Development, line 720 character 15
SCRIPT5007: Unable to get value of the property '_mfClazz': object is null or undefined 
jsf.js.jsf?ln=javax.faces&stage=Development, line 720 character 15
SCRIPT5007: Unable to get value of the property 'engine': object is null or undefined 
IFrame.js.jsf?ln=org.apache.myfaces.core.impl.xhrCore, line 27 character 1
SCRIPT5009: '_MF_OBJECT' is undefined 
_AjaxRequest.js.jsf?ln=org.apache.myfaces.core.impl.xhrCore, line 32 character 1
SCRIPT5009: '_MF_OBJECT' is undefined 
_AjaxResponse.js.jsf?ln=org.apache.myfaces.core.impl.xhrCore, line 32 character 1

Solution

  • Its not tomcat who is adding the jsf.js , its the jsf implementation library (in your case myfaces) read this one ()What can cause “jsf is not defined” error in browser console

    so its normal

    regarding your errors , maybe you got some illegal html structure? like nested forms? what version of myfaces are you using ? is it official rls version ? try a more recent one

    another option would be to try to add the js file manually (just to see if its any good) like this

    <h:outputScript name="jsf.js" library="javax.faces" target="head"/>