myfaces + ajax + IE - 页面加载问题

时间:2012-08-23 18:20:07

标签: ajax internet-explorer jsf-2 myfaces

我将f:ajax标签添加到我的一个页面后,tomcat自动将jsf.js脚本插入到标题中:

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

它在页面加载时开始在IE中引起一些奇怪的错误。最令人惊讶的是,每次重新加载页面时,它们发生的错误和位置的数量可能会有所不同,有时甚至会显着不同我应该在Chrome中提到一切都没有任何问题吗?

    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

1 个答案:

答案 0 :(得分:2)

它不是添加jsf.js的tomcat,它的jsf实现库(在你的情况下是myfaces)读取这个()What can cause “jsf is not defined” error in browser console

所以正常

关于你的错误,也许你有一些非法的html结构?喜欢嵌套表格? 你用的是什么版本的myfaces?它是官方rls版本?尝试更新的

另一种选择是尝试手动添加js文件(只是为了看看它是否有用),就像这样

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