aspose file tools*
The moose likes JSF and the fly likes Access Html-body Tag from managed bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Access Html-body Tag from managed bean" Watch "Access Html-body Tag from managed bean" New topic
Author

Access Html-body Tag from managed bean

Alex Horst
Greenhorn

Joined: Jun 30, 2008
Posts: 2
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.
Ryan Lubke
Ranch Hand

Joined: Jun 20, 2007
Posts: 36
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

Joined: Jun 30, 2008
Posts: 2
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Access Html-body Tag from managed bean