permaculture playing cards*
The moose likes JSF and the fly likes Trying to change <ui:include> src tag dinamically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Trying to change <ui:include> src tag dinamically" Watch "Trying to change <ui:include> src tag dinamically" New topic
Author

Trying to change <ui:include> src tag dinamically

Vladislav Simovic
Ranch Hand

Joined: Feb 03, 2011
Posts: 37
I have main page that looks like this:

What i want to do is have a bean like this and change dinamically which page is included. This is how bean looks like:

When i click button Push i want this page to be included:

Problem is that i have to press the button twice for page to be included. How can this be done so when i press the button the first time page is included.
Krystian Gor
Ranch Hand

Joined: Jan 11, 2011
Posts: 30
I don't know how to do this but I can tell you why it happens.
If you use a getPage method like this you can observe what's going on.

<ui:include is using the first phase of JSF lifecycle to get value of #{bean.page}. So if you click commandButton it gets old value even before action method changePage is called. That's why it's always one click late. Seems like there is no way to do this with ui:include. Doesn't matter if you use Ajax or Primefaces, it's JSF thing.
 
Consider Paul's rocket mass heater.
 
subject: Trying to change <ui:include> src tag dinamically
 
Similar Threads
javax.el.PropertyNotFoundException: Objetivo inalcanzable - JSF - Facelet - method-signature
JSF 2.0 Login
Problem achieving masterpage functionality in JSF
Why events are not fired when value changes in h:selectOneMenu? I am stuck!
ui:repeat + AJAX