File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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 #{}. 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.
I agree. Here's the link:
subject: Trying to change <ui:include> src tag dinamically
It's not a secret anymore!