This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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


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: 17011
    
  26



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.

 
Have you checked out Aspose?
 
subject: Invoking bean from included JSF page
 
It's not a secret anymore!