0

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.

Community
  • 1
  • 1
vinod
  • 1,178
  • 4
  • 16
  • 42
  • And what is the code of your button actually? – Alexandre Lavoie Oct 31 '13 at 11:17
  • @AlexandreLavoie i have added button code please look into this – vinod Oct 31 '13 at 11:27
  • @BalusC please look into this.. – vinod Oct 31 '13 at 13:50
  • 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 Nov 01 '13 at 08:06
  • `@nickname` comment-replies works only if the person in question has commented on the post before. – BalusC Nov 01 '13 at 19:21
  • @BalusC Sorry for that could you please help me with this.. – vinod Nov 02 '13 at 13:58

2 Answers2

0

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.

Community
  • 1
  • 1
vels4j
  • 11,208
  • 5
  • 38
  • 63
  • @vels4j Thanks and i agree with you but i dont think it will solve the problem please look into the xml response which i mentioned in the problem.. – vinod Oct 31 '13 at 12:46
  • What is ShowLoader in onClick ?. Also give a try with partialSubmit="true" – vels4j Oct 31 '13 at 12:57
  • its just for showing one loading image and tried with partialSubmit="true" as well... – vinod Oct 31 '13 at 13:11
  • for that you can use ice:outputConnectionStatus http://icefaces-showcase.icesoft.org/showcase.jsf;jsessionid=D91E1EEDF6C7564BD02C8A822271C0F9?grp=compatMenu&exp=connectionStatus – vels4j Oct 31 '13 at 13:24
0

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>
Narayana Nagireddi
  • 729
  • 1
  • 13
  • 33