Search code examples
javascriptjsf-2richfaces

I am getting an error "Uncaught Reference Error: jsf is not defined at HTMLAnchorElement.onclick"


I am using JSF2.2 with RichFaces4.5. I have an xhtml page with a custom defined jsf tag for pdf pop up. But when I click on the pdf link in the page, I am getting the error:

Uncaught Reference Error: jsf is not defined at HTMLAnchorElement.onclick

in the browser JavaScript console.

I saw few questions which have been already posted related to this issue and the answers provided were to include head or body tags in the xhtml page. I tried those but still I am getting the same error.


Solution

  • The problem was jsf.js was not initializing in the xhtml page.I added the following line (without double quotes surrounding the greater than/less than symbol) in my xhtml inside h:head tag and its working fine.

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