admin管理员组文章数量:1287584
Hi I got a simple fresh project based on MyFaces 2.0.11 with Primefaces 3.0 on Tomcat 6
When I'm trying to navigate to a page I'm getting Uncaught ReferenceError: jsf is not defined
error which directs me to a ref in my js code jsf.ajax.addOnEvent
... (which is reasonable cause I'm trying to use the jsf.js and it's not event present I'm my page..)
And if I do view source of my page I dont the the include of the jsf.js
file
Now if I add it manually like this
<h:outputScript name="jsf.js" library="javax.faces" target="head"/>
every thing works just fine... but I prefer not to include it manually , Instead I would like to know what are the reasons that can cause the lack of the jsf.js in my page
I google for a while and none of the similar case represents mine
I do have <h:head>
and <h:body>
My page is really simple...
Any Ideas?
Hi I got a simple fresh project based on MyFaces 2.0.11 with Primefaces 3.0 on Tomcat 6
When I'm trying to navigate to a page I'm getting Uncaught ReferenceError: jsf is not defined
error which directs me to a ref in my js code jsf.ajax.addOnEvent
... (which is reasonable cause I'm trying to use the jsf.js and it's not event present I'm my page..)
And if I do view source of my page I dont the the include of the jsf.js
file
Now if I add it manually like this
<h:outputScript name="jsf.js" library="javax.faces" target="head"/>
every thing works just fine... but I prefer not to include it manually , Instead I would like to know what are the reasons that can cause the lack of the jsf.js in my page
I google for a while and none of the similar case represents mine
I do have <h:head>
and <h:body>
My page is really simple...
Any Ideas?
Share Improve this question edited Apr 2, 2012 at 13:53 BalusC 1.1m376 gold badges3.6k silver badges3.6k bronze badges asked Apr 2, 2012 at 6:44 DanielDaniel 37.1k10 gold badges122 silver badges204 bronze badges 2- If you have a h:head on your page the script should be there. Check if it isn't skipped somehow by putting eg a title inside it. – Mike Braun Commented Apr 2, 2012 at 8:24
- Added title... title is being display properly but the jsf.js still isn't being added... – Daniel Commented Apr 2, 2012 at 9:05
1 Answer
Reset to default 8This script will only be auto-included whenever you use <f:ajax>
in the view. If you don't, then it won't be auto-included.
Just add an extra check before you call jsf.ajax.addOnEvent
:
if (typeof jsf !== 'undefined') {
jsf.ajax.addOnEvent(someFunctionName);
}
Or, explicitly include the library by <h:outputScript>
on the proper library
, like as you already did.
本文标签: javascriptWhat can cause quotjsf is not definedquot error in browser consoleStack Overflow
版权声明:本文标题:javascript - What can cause "jsf is not defined" error in browser console - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741238436a2363487.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论