This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread 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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
 
Similar Threads
PLEASE HELP java.lang.LinkageError
Strange behavior: action method not called when button submitted
ArrayList<Future<Integer>> results = new ArrayList<Future<Integer>>();
Argument Error: One or more parameters are null.