• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Access Html-body Tag from managed bean

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Is it possible to access the <body> element from a managed bean?
I want to add the "onLoad" attribute programmatically.





The statement above returns null. I guess this is because the ViewRoot contains JSF-Components only?

Thanks in advance.
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Alex Horst:
Hi,
Is it possible to access the <body> element from a managed bean?
I want to add the "onLoad" attribute programmatically.





The statement above returns null. I guess this is because the ViewRoot contains JSF-Components only?

Thanks in advance.



In short yes. If you want to have access to the 'head' then you need a head component. It would be simple to write one, though component libraries such as woodstock [1] have a head component.

Additionally, JSF 2.0, there will be a basic head component included.

[1] https://woodstock.dev.java.net
 
Alex Horst
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply,

I'm using richfaces and haven't found a "head" component there. But I found <a4j:jsFunction>
which solved my problem. Instead of using the "onload" attribut I now call my javascript function with
the jsFunction component.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic