File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Pass value to ManagedBean in Facelet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Pass value to ManagedBean in Facelet" Watch "Pass value to ManagedBean in Facelet" New topic
Author

Pass value to ManagedBean in Facelet

John Storta Jr.
Greenhorn

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.

Thanks
C Bell
Greenhorn

Joined: Jun 29, 2009
Posts: 5
Hello John,
Try using the jstl tag set, http://java.sun.com/javaee/javaserverfaces/2.0/docs/pdldocs/facelets/c/set.html, to replace your jsp:setProperty.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Pass value to ManagedBean in Facelet
 
Similar Threads
Looping in JSF
JSF templates
viewScoped bean recreated on page reload
Performance issues using ajax
Resultset elements not getting displayed in jsp when using JSP/JSTL