i have made it in #2 way - that was described in my last post
it works great (and opens in browser window:P )
Sławek Sobótka
Someone has made it (the onclick popup) ! You can find it there :
http://www.jenia.org
Or view a demo here : http://www.jenia.org/TestPopup/jsp/index.jsp
That don't solve my problem entirely, because I want my page to be
opened in a browser window, but I think I gone use it somewhere else in
my application.
Thanks for the contribution ;)
Clément
-----Message d'origine-----
De : Sean Schofield [mailto:[EMAIL PROTECTED]
Envoyé : jeudi 21 juillet 2005 16:12
À : MyFaces Discussion
Objet : Re: commandLink and onClick javascript popup window problem
I think your problem is that you are opening the window with an
*onclick* javascript even. This has nothing to do with the JSF
lifecycle. The regular commandLink approach (without using onclick)
works because you post back (via a form) to the same page. In your
case you are just opening the page in a new window. How would JSF
know the new values from that?
sean
On 7/21/05, Clément Maignien <[EMAIL PROTECTED]> wrote:
Here is the situation :
I have a JSF page (result.jsp) with dataTable component with a
commandLink
in one of his columns.
When clicking on this commandLink, I would like to open a popup window
(detailStockInv.jsp) to display detail informations about the line that
has
been clicked.
Here is the code I wrote :
<x:dataTable id="stockdatatable" rowIndexVar="numRow"
...
<h:column> ... </h:column>
...
<h:column>
<f:facet name="header">
<h:outputText value="#{res['stock_Etat_Visu_Stockinv']}" />
</f:facet>
<h:commandLink styleClass="linkRed"
actionListener="#{stockBean.updateDetailStock}
onclick="window.open('detailStockInv.jsp','','width=700,height=400,top=100,left=100')">
<h:outputText value="#{stock.stockInv}"/>
<f:param name="numLineClicked" value="#{numRow}"/>
</h:commandLink>
</h:column>
...
</x:dataTable>
I've put an actionListener to update datas (a bean property) that are
displayed in the popup page (detailStockInv.jsp) in a dataTable
component.
My popup is opened and displayed when I click one of the commandLink of
my
results dataTable, but the problem is that the bean values that are
read by
my popup page are the previous ones : the first time I click a
commandLink,
the values displayed by the popup are not the ones updated by my
actionListener but the initial ones (inited in the bean constructor).
The
second time I click a commandLink, the values of the line I cliked
before
are displayed.
In my opinion, the popup is displayed before the update model value
phase of
the JSF life cycle occurs. As a consequence, the previous bean values
are
displayed in my popup page.
To confirm that, I tried not to display this page in a popup, but in the
same window (normal flow) with the action property of the commandLink :
<h:commandLink styleClass="linkRed"
action="#{stockBean.showDetailAction}"
<h:outputText value="#{stock.stockInv}"/>
<f:param name="numLigneClicked" value="#{numRow}"/>
</h:commandLink>
The showDetailAction action and the updateDetailStock actionListener are
doing exactly the same work (updating the detail values of my bean),
except
that it return a navigation result to display the detailStockInv.jsp
page
In this way, the values that are displayed in the detailStockInv.jsp
are the
good ones (the bean's ones).
Is there a way to force the update value phase before the popup is
displayed
? Maybe the way I call the popup isn't the right one ... don't know.
Please help, thanks :D
Clément Maignien.