RE : commandLink and onClick javascript popup window problem
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.
Re: RE : commandLink and onClick javascript popup window problem
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.
RE : RE : commandLink and onClick javascript popup window problem
Thanks Sławek, I'll try it as soon as I can. Thanks again for your help ;) Clément -Message d'origine- De : Slawek [mailto:[EMAIL PROTECTED] Envoyé : vendredi 22 juillet 2005 11:33 À : MyFaces Discussion Objet : Re: RE : commandLink and onClick javascript popup window problem 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.
RE: RE : commandLink and onClick javascript popup window problem
Yes, that works well. That method is similar to index.jsp and popup.jsp in Chapter 12 of Core JavaServer Faces in that the parameters are passed as request parameters in the URL. The popup JSP can then access the values using param.xxx and param.yyy. Another method outlined in that chapter is supposed to use JSF to pass the parameters to the popup window via the normal managed bean method, so the popup window just references the managed bean and not explicit request parameter values. That seems like a more JSF-oriented approach. Unfortunately, it doesn't work as written, and I'm curious whether anyone has gotten it to work. (This example is given in index2.jsp and popup2.jsp in Chapter 12 of the book.) - Brendan -Original Message- From: Slawek [mailto:[EMAIL PROTECTED] Sent: Friday, July 22, 2005 4:33 AM To: MyFaces Discussion Subject: Re: RE : commandLink and onClick javascript popup window problem 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.
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.
RE : commandLink and onClick javascript popup window problem
Yes indeeed Sean. That's is exactly what I said at the end of my post. But my question is : is it possible to open a popup window (with or without javascript) to display my detailed informations ? if yes, how ? Thanks. -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.
Re: RE : commandLink and onClick javascript popup window problem
There is a component x:popup wich you could use, but it shows only onmouseover (if someone had the time to adapt this component to show onclick it would be great, the possibility to choose if the popup should be shown on onmouseover or onclick). Regarding your problem, maybe you can use a session bean with the information of your table and open a new jsf page in a new window which used the same bean...). HTH, Bruno 2005/7/21, Clément Maignien [EMAIL PROTECTED]: Yes indeeed Sean. That's is exactly what I said at the end of my post. But my question is : is it possible to open a popup window (with or without javascript) to display my detailed informations ? if yes, how ? Thanks. -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.
RE : RE : commandLink and onClick javascript popup window problem
Yes I tried to use the x:popup component but it is not appropriate for what I want to do. Having a onclick behaviour ont it would be great :D The solution you propose is actually what I tried to do. But the problem is that I use javascript to open the new window. It brakes the JSF flow and my backing bean values are not the update ones. Thanks for your help ;) -Message d'origine- De : Bruno Aranda [mailto:[EMAIL PROTECTED] Envoyé : jeudi 21 juillet 2005 16:42 À : MyFaces Discussion Objet : Re: RE : commandLink and onClick javascript popup window problem There is a component x:popup wich you could use, but it shows only onmouseover (if someone had the time to adapt this component to show onclick it would be great, the possibility to choose if the popup should be shown on onmouseover or onclick). Regarding your problem, maybe you can use a session bean with the information of your table and open a new jsf page in a new window which used the same bean...). HTH, Bruno 2005/7/21, Clément Maignien [EMAIL PROTECTED]: Yes indeeed Sean. That's is exactly what I said at the end of my post. But my question is : is it possible to open a popup window (with or without javascript) to display my detailed informations ? if yes, how ? Thanks. -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.
RE: RE : RE : commandLink and onClick javascript popup window problem
We've been trying to do the same thing. We started working with the example given in Chapter 12 of the book Core JavaServer Faces (p. 587: How do I generate a popup window?). Actually, the book gives 2 examples: a simple one (involving index1.jsp and popup1.jsp), and a more robust one like what Clement is talking about (involving index2.jsp and popup2.jsp). Unfortunately, the second example in the book (involving index2.jsp and popup2.jsp) doesn't work. :( If some expert out there can tweak index2.jsp and popup2.jsp and provide us with the corrections (or provide a similar small example), it would be much appreciated. - Brendan -Original Message- From: Clément Maignien [mailto:[EMAIL PROTECTED] Sent: Thursday, July 21, 2005 10:07 AM To: MyFaces Discussion; Bruno Aranda Subject: RE : RE : commandLink and onClick javascript popup window problem Yes I tried to use the x:popup component but it is not appropriate for what I want to do. Having a onclick behaviour ont it would be great :D The solution you propose is actually what I tried to do. But the problem is that I use javascript to open the new window. It brakes the JSF flow and my backing bean values are not the update ones. Thanks for your help ;) -Message d'origine- De : Bruno Aranda [mailto:[EMAIL PROTECTED] Envoyé : jeudi 21 juillet 2005 16:42 À : MyFaces Discussion Objet : Re: RE : commandLink and onClick javascript popup window problem There is a component x:popup wich you could use, but it shows only onmouseover (if someone had the time to adapt this component to show onclick it would be great, the possibility to choose if the popup should be shown on onmouseover or onclick). Regarding your problem, maybe you can use a session bean with the information of your table and open a new jsf page in a new window which used the same bean...). HTH, Bruno 2005/7/21, Clément Maignien [EMAIL PROTECTED]: Yes indeeed Sean. That's is exactly what I said at the end of my post. But my question is : is it possible to open a popup window (with or without javascript) to display my detailed informations ? if yes, how ? Thanks. -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
Re: RE : commandLink and onClick javascript popup window problem
there is race between two requests: -submit form (perform actions) and receive answer -open popup with new page if submit would win (hit server looong beforem popup request), than action would be performed and popup could have fresh data in 99.(9)% cases popup wins, so it doesnt have proper data generated by its parent request. the most obvious solution (and the worst:P) is to generate delay in popup window - its stupid so lets leave it. i have 2 concepts: 1. in your parent page u can have body onload=openPopup() so u are sure that popup will be opened AFTER submit. 2. u can pass parameter to popup: onclick=window.open('detailStockInv.jsp?id=#{row.id}','','width=700,height=400,top=100,left=100') detailStockInv.jsp page must get parmeter id from url and ofcourse perform somme logic (i assume that row is your var attrib from datatable). cheers Slawek Yes indeeed Sean. That's is exactly what I said at the end of my post. But my question is : is it possible to open a popup window (with or without javascript) to display my detailed informations ? if yes, how ? Thanks. -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.