Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about sequence of calls to a Bean with request scope?

 
kiril mitov
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a question about the sequence of calls to a Bean in a JSF application.

I have a simple search page with a field and a search button.

The search bean, with request scope, looks like this:

Now when the search page is displayed a new Search bean (I will call it Search1) is instatinated. Then the Search1.getName is called and the page is displayed.

When I press the Search button a new instance of a Search bean (Search2) is instatinated. Then
Search2.getName() is called.
Search2.setName() is called.
Search2.doSearch() is called.

Does anybody know why is Search2.getName() called?
The newly constructed bean can not return a correct value. The value is in Search1. Is there a reason for Search2.getName() to be called?

I have debugged this on glassfish 2, if that matters.

Thanks in advance.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It happens during validations phase. It needs the initial value to check if it is different from the submitted value.
 
kiril mitov
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic