Issue Details (XML | Word | Printable)

Key: SHALE-220
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Craig McClanahan
Reporter: Craig McClanahan
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Shale

init() lifecycle method called twice

Created: 16/Jul/06 08:41 PM   Updated: 25/Sep/08 04:25 AM
Component/s: View
Affects Version/s: 1.0.2, 1.0.3
Fix Version/s: 1.0.4


 Description  « Hide
From a user mailing list posting by Viswanath <v_ramineni AT hotmail.com>, following up on earlier mailing list conversations:

==========

Hi Craig,

Now that I have subscribed to Shale user group, I am posting this issue again.

Just to make sure that I am not using older version of Shale libraries, I have downloaded shale-framework-20060713.zip and tried, same problem. This is what I did, to reproduce the issue in usecases project. ( I am not able to post code from my project because of lot of dependencies on EJBs/Database)

I downloaded the latest usecases zip (07/14/2006). Unzipped the war file into a directory, created a project in eclipse, added the java source files, built and deployed it into JBOSS and it ran fine. Added the following code at the end of org/apache/shale/usecases/locale/Select.java overriding the "do-nothing" init() from ActionViewController.

   public void init()
   {
        System.out.println("Select.java - Init - PostBack Value: " + Boolean.toString(isPostBack()));
   }

redeployed and ran. The console output when I click on "Select Language" link

15:20:27,515 INFO [STDOUT] Select.java - Init - PostBack Value: false
15:20:27,515 INFO [STDOUT] Select.java - Init - PostBack Value: false

and on sumbit (when I click on "Go" )

15:20:33,546 INFO [STDOUT] Select.java - Init - PostBack Value: false
15:20:33,562 INFO [STDOUT] Select.java - Init - PostBack Value: true

My environment is :

OS : Windows XP Home
JBOSS 4.0.4 Patch1 with Tomcat 5.5
JRE : 1.5.0_06
Eclipse 3.1.1


Thanks
Vish

==========

I was able to reproduce this with latest trunk bits, using the default testing configuration (MyFaces, Tomcat 5.5). It's clearly a bug in how init and destroy method callbacks are being triggered for view controllers, most likely related to the fact that the mechanism for this was recently changed.


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Craig McClanahan added a comment - 17/Jul/06 03:17 AM
Fixed in nightly build 20060717. There were two related bugs ... the init() and destroy() methods were indeed being called twice, and the postBack property was not being initialized prior to the call to the init() method. Both of these problems have been fixed, and a system integration test added to verify correct behavior in the future.

Thanks for the bug report!

Bob Butash added a comment - 29/Sep/06 12:14 PM
I have an issue that is similar to Shale 220 (http://issues.apache.org/struts/browse/SHALE-220). I am using Shale version 1.0.3 and for normal View/ViewController processing the init method is only being invoked once. However I have a subview that has a ViewController backing bean associated with it. The sub view's init call back method is being called twice. Is this a known issue, and is there any way to prevent it.

Craig McClanahan added a comment - 29/Sep/06 04:27 PM
Reopening, as Bob Butash reports similar symptoms when using 1.0.3.

Wendy Smoak added a comment - 08/Oct/06 09:25 PM
Adjusted affects and fix-for versions

Craig McClanahan added a comment - 18/Oct/06 10:57 PM
I have reviewed the subview lifecycle events handling, and the current nightly build version (20041018) handles the events properly (init is called once per subview, and all the other event handlers are called correctly as well). Therefore, I'm going to mark this one as fixed.