• Post Reply Bookmark Topic Watch Topic
  • New Topic

p:growl doesnt show up

 
Jorge Martinez
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • 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
 
Tim Holloway
Bartender
Posts: 18417
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
Bartender
Posts: 18417
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!