I have the following page:
<h:form id="gameSelectionForm">
<h:selectOneMenu id="gameSelection">
<f:selectItems value="#{gameBean.gameIds}" />
</h:selectOneMenu>
<h:commandButton id="gameSelector" value="Play" action="#{gameBean.changeGame}" />
</h:form>
<h:panelGroup id="gameDiv">
<f:verbatim>
<iframe src="/levelup/resources/games/#{gameBean.gameId}/#{gameBean.htmlPage}" width="700px" height="800px" frameborder="0"/>
</f:verbatim>
</h:panelGroup>
When I click on the "gameSelector" button, here is the sequence of events: 1. gameBean.getGameId and gameBean.getHtmlPage are called 2. gameBean.changeGame is called 3. The page is refreshed.
My issues lies in the order of 1. and 2. The changeGame modifies a gameBean variable that is used by the getGameId and getHtmlPage. I thus want to it execute first, so that when other panels are refreshed, they contain the proper data.
Please note that this issue seems to occur only for the call within the gameDiv element (other variables are properly refreshed).
Would you have any idea as to what I could do to revert the order of 1. and 2., so that the changeGame() method is the first one called?
I am using JavaServer Faces 2.0 on Tomcat 7.0.
Thanks in advance