This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSF and the fly likes Pass value to ManagedBean in Facelet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Pass value to ManagedBean in Facelet" Watch "Pass value to ManagedBean in Facelet" New topic

Pass value to ManagedBean in Facelet

John Storta Jr.

Joined: Jul 26, 2009
Posts: 29
I am currently converting my old JSP pages to JSF 2.0 facelets. So far I am very impressed with the framework. I am running into an issue on one thing.

I have a bean that I use to load assorted stylesheets based on what browser is being used, the theme and the specific section of the site. This bean provides a list of stylesheets and those are added to the page as <LINK>s

Here is the original code.

This works great. Now I am trying to convert this to the facelet and I am running into some problems locating the functionality that I need.

This is what I have so far in my facelet.

This also works great, except in my original code I am also passing values to the bean before I generate the list. I cannot find a way to pass values to the managedbean from within the facelet.

All of the references I have found online refer to setting managedproperties in an xml file, but I need to be able to set the properties from the facelet page since the values will be different for each page.

Is there some equivalent to the <jsp:setProperty> tag in Facelets?

I am not sure if this is not possible in JSF 2.0 facelets or if I am just not looking in the right place.

C Bell

Joined: Jun 29, 2009
Posts: 7
Hello John,
Try using the jstl tag set,, to replace your jsp:setProperty.
I agree. Here's the link:
subject: Pass value to ManagedBean in Facelet
It's not a secret anymore!