What can cause “jsf is not defined” error in browser console

后端 未结 1 463
暗喜
暗喜 2021-01-04 16:11

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 ReferenceE

相关标签:
1条回答
  • 2021-01-04 16:23

    This 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.

    0 讨论(0)
提交回复
热议问题