This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes Question about sequence of calls to a Bean with request scope? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "Question about sequence of calls to a Bean with request scope?" Watch "Question about sequence of calls to a Bean with request scope?" New topic
Author

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

kiril mitov
Greenhorn

Joined: Dec 17, 2005
Posts: 8
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

Joined: Oct 08, 2006
Posts: 2458
It happens during validations phase. It needs the initial value to check if it is different from the submitted value.
kiril mitov
Greenhorn

Joined: Dec 17, 2005
Posts: 8
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about sequence of calls to a Bean with request scope?