Javascript does not work under JSF template

前端 未结 2 916
你的背包
你的背包 2021-02-10 00:41

I\'m using JSF templates and Primefaces.

Javascript code does not seem to be working under ui:composition and ui:define tags. The following code is not hitting the load

2条回答
  •  我在风中等你
    2021-02-10 01:28

    Everything outside is ignored during building the view. Also, redeclaring once again is unnecessary. To use a script which runs during on page load, better use a . This will be relocated to end of body and thus be invoked after the necessary HTML DOM elements are been built. This is also somewhat faster than an onload.

    All with all, your entire content.xhtml must look like this:

    
        
            
                alert("Working!!");
            
    
            

    Random text

    See also:

    • How to include another XHTML in XHTML using JSF 2.0 Facelets?

提交回复
热议问题