Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trying to change <ui:include> src tag dinamically

 
Vladislav Simovic
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic