0
votes

i am using jsf 2.0 and icefaces 3.0. i have migrated my application from icefaces 1.8 to 3.0 but i am facing one issue for ice:commandbutton on every jsf page. it needs second click everytime then its sending the response to the broswer, i debugeed the issue by using IE developer tools (F12 in IE) by using network tab. so when i am hitting first time i am getting following repsonse :

   <?xml version='1.0' encoding='UTF-8'?>
<partial-response><changes><update id="javax.faces.ViewState"><![CDATA[8640112048343005235:64165239481062360]]></update><extension aceCallbackParam="validationFailed">{"validationFailed":false}</extension></changes></partial-response>

and on second click it working.

following is my button code.

<ice:commandButton value="#{msgs['submit.label']}"
                                            id="submitCmd2" type="submit"
                                            actionListener="#{applicationController.submit}"
                                            rendered="true" styleClass="buttonpurple" onclick="showLoader();"
                                            style="width: 125px; " align="center" />

but i am not able to understand what is the cause and what solution i need to use to solve this problem. also i have gone through balusC links commandButton/commandLink/ajax action/listener method not invoked or input value not updated

Thanks in advance.

2
And what is the code of your button actually? - Alexandre Lavoie
@AlexandreLavoie i have added button code please look into this - vinod
@BalusC please look into this.. - vinod
I think i got the problem is about life cycle issue.. on jsf page i have valuechangelisteners and each valuechangelistener has line FacesContext.getCurrentInstance().renderResponse(); i commented that line and then its working but i am not able to find why they are using renderResponse at the end of valueChangeListener.. and commenting this line is there any side effectes... - vinod
@nickname comment-replies works only if the person in question has commented on the post before. - BalusC

2 Answers

0
votes

Instead of using actionListener try action in ice:commandbutton. There are some differences-between-action-and-actionlistener.

<ice:commandButton value="#{msgs['submit.label']}"
                                        id="submitCmd2" type="submit"
                                        action="#{applicationController.submit}"
                                        rendered="true" styleClass="buttonpurple" onclick="showLoader();"
                                        style="width: 125px; " align="center" />

Also type='submit' is not required, by default it is submit.

0
votes

You can try the workaround described here

If that doesn't work, you can try ajax with jsf commandbutton, in it's own best way.

<h:commandButton value="#{msgs['submit.label']}"
                                    id="submitCmd2" 
                                    actionListener="#{applicationController.submit}"
                                    styleClass="buttonpurple" onclick="showLoader();"
                                    style="width: 125px; " align="center">
  <f:ajax execute="id1 id2 id3...." render="@form"/>
</h:commandButton>