This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes Invoking bean from included JSF page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Invoking bean from included JSF page" Watch "Invoking bean from included JSF page" New topic
Author

Invoking bean from included JSF page

Naveen Sampra
Ranch Hand

Joined: Jun 11, 2003
Posts: 70
I have a common toolbar which I want to include on any JSF page when needed. However I need a way to pass my pageBean to toolbar and access properties/methods on the passed pageBean.
The pageBean is in request scope.

Below is the code. I want to include common_toolbar.xhtml into page1.xhtml
common_form.xhtml is where my template is defined and I have not listed, since it is not needed to show my example.

page1.xhtml:


/pages/common_toolbar.xhtml


The page renders fine but when i click on save link I get following error:



On the save, why is JSF framework not creating and setting 'myPage1Bean' in request scope ?





Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19



Customer surveys are for companies who didn't pay proper attention to begin with.
Naveen Sampra
Ranch Hand

Joined: Jun 11, 2003
Posts: 70
How would I reference myPage1Bean that is passed to the include file?
I need to reference both a property(say idValue and action listener(say myListener).

I need to use idvalue on a <h:selectOneListbox ...> component and myListener on a <h:commandLink ...> component.

Appreciate if you can help with correct usage since I'm getting errors when I tried value="#{pageBeanName).idValue" or binding="#{pageBeanName).idValue" etc.
Naveen Sampra
Ranch Hand

Joined: Jun 11, 2003
Posts: 70
I figured this one out.

 
Don't get me started about those stupid light bulbs.
 
subject: Invoking bean from included JSF page
 
Similar Threads
Help for an error I can't understand: "Could not Resolve Variable [Overflow]" while ...
Problem getting richfaces tree to display
internationlization in facelet seems not working well
Navigation Problem
Simple loop/function in XHTML page