0

在我将 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
4

1 回答 1

2

添加的不是tomcat jsf.js,它的jsf实现库(在你的情况下是myfaces)读了这个()什么可能导致浏览器控制台中的“jsf is not defined”错误

所以这是正常的

关于你的错误,也许你有一些非法的 html 结构?像嵌套形式?你用的是什么版本的myfaces?rls 官方版本吗?尝试更新的

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

<h:outputScript name="jsf.js" library="javax.faces" target="head"/>
于 2012-08-23T18:46:04.960 回答