This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes Unwanted behavior: Action method being called several times Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Unwanted behavior: Action method being called several times" Watch "Unwanted behavior: Action method being called several times" New topic
Author

Unwanted behavior: Action method being called several times

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello,
I have a managed bean that calls a session ejb which itself does a search. The problem is that it is supposed to retrieve a resultset ONCE and the displayed behavior is that it never stop doing so. It fetches the resultset SEVERAL TIMES.

Here is the managed bean and the method to look at is the performSearch method:



Here is the object request passed:



and here is the session ejb:



I just don't understand why it does so. The peformSearch should be executed ONCE only.

Here is my face config file:



Can anyone help?

Thanks in advance,

Julien.
Daniel Rhoades
Ranch Hand

Joined: Jun 30, 2004
Posts: 186
You will probably get at least two searches happen due to JSF lifecycles:

- renderView phase (1st time you see the page)
- restoreView phase (when you execute another action)

But it depends on your how you are moving from one page/action to another.


Drinking more tea is the key...
Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Thanks Daniel,
The problem is that it is executed 20 to 30 times instead of once...
Julien.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unwanted behavior: Action method being called several times