Win a copy of Functional Design and Architecture this week in the Functional programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

p:growl doesnt show up

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hy,

When using primefaces and try to get a p:growl element to work, it doesnt show up and inspecting the code i get this:

//-->

1. In the code as you can see, the jquery javascript is commented, why?
2. primefaces uses jquery but how it works if in the xhtml file I am not including any script that loads a jquery library?

Thanks
 
Saloon Keeper
Posts: 24283
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PrimeFaces itself loads jQuery automatically. Caution: When incorporating jQuery with JSF extension libraries, make sure that the version of the jQuery that the extension library includes is compatible with the version of jQuery that your code uses. Some of those extension libraries use really old versions of jQuery.

It's possible that the commented javascript is some "cleverness" on the part of the support software. There's a chance that another bit of javascript code is extracting the commented item's text from the page DOM and interpreting it. Having the original code commented may be a way to prevent its premature execution, avoid function naming conflicts, or something similar.

It would be a good idea to post the original JSF template code, though. That way we might be able to tell more.
 
Jorge Martinez
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hy,

I post the template code:




In the source html code, I dont see any jquery library loaded. I think its the problem, right?


Thanks
 
Jorge Martinez
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hy,

Already solved! I didnt know I had to use <h:head> tag instead of <head> for loading the jquery and so on.

Thanks!
 
Tim Holloway
Saloon Keeper
Posts: 24283
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jorge Martinez wrote:Hy,

Already solved! I didnt know I had to use <h:head> tag instead of <head> for loading the jquery and so on.

Thanks!



This is a an easy trap to fall into. JSF 1 didn't have h:head and h:body tags. They were added to JSF2, but older code, older documentation, and older programmers won't be aware of this.

JSF2 added standardized attachment points for custom tags to insert out-of-line code, CSS and other items and these new tags anchor those points.

Just to make things worse, older JSF tagsets such as the original Apache Tomahawk, RichFaces, and so forth had found their own (differing) ways of anchoring their code insertions that didn't rely on the h:head and h:body (since they didn't exist yet). So you would have pages with jQuery on them that worked just fine without those tags, since alternative mechanisms were doing the job. But those mechanisms are now obsolete!
 
Dinner will be steamed monkey heads with a side of tiny ads.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic