Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Executing two f:ajax in h:commandButton

 
Lucas Murata
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a commandButton that when clicked must execute two ajax listener, i did code bellow:



This code is working fine. Strange that it's execute two times. Total of 4 calls to the method .

When I put only 1 f:ajax into h:commandButton, it's work fine, and calls just one time.

How to can call two f:ajax listener without repeat two times?
 
Cesar Loachamin
Ranch Hand
Posts: 90
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lucas

Welcome to JavaRanch!!!

This is because you're binding two ajax listener to the same event in this case for the action event, one thing you could do is set another event for the first ajax listener, like this:
Try it, ti works.
But I suggest you, that you can use a single ajax call, put the logic of the method2 in method1 and render the two components like this:

Regards
Cesar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic