Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.6.1, 1.6.2
-
Fix Version/s: 1.8.2
-
Component/s: Framework, Tool Integrations
-
Labels:None
-
Environment:Icefaces 1.6.2, Glassfish V2, Sun's JSF RI 1.2_04-b10-p01, Netbeans 6.0. Also tested with same results on Tomcat 6 and with Icefaces 1.6.1.
-
ICEsoft Forum Reference:
Description
When using Icefaces, the lifecycle events such as init(), destroy(), prerender(), preprocess() are not consistently called on request-scoped beans that come with Netbeans (e.g. inherited from AbstractPageBean).
I attach two identical projects (see attachments to forum post http://www.icefaces.org/JForum/posts/list/7010.page) with and without Icefaces that demonstrate the problem. The project contains two pages - Page1 contains a button that takes user to Page2 and Page2 has a button that takes him back to Page1. Each event that fires writes a message to the server log. Let's look at the logs:
TestJsf project is pure JSF (doesn't use Icefaces) generates correct sequence of events:
-- original request to Page1
Page1 constructor testjsf.Page1@1ae4426
Page1 init() testjsf.Page1@1ae4426
Page1 prerender() testjsf.Page1@1ae4426
Page1 destroy() testjsf.Page1@1ae4426
-- button on Page1 clicked
Page1 constructor testjsf.Page1@9e3065
Page1 init() testjsf.Page1@9e3065
Page1 preprocess() testjsf.Page1@9e3065
Page1 button action testjsf.Page1@9e3065
Page2 constructor testjsf.Page2@710a3b
Page2 init() testjsf.Page2@710a3b
Page2 prerender() testjsf.Page2@710a3b
Page1 destroy() testjsf.Page1@9e3065
Page2 destroy() testjsf.Page2@710a3b
-- button on Page2 clicked
Page2 constructor testjsf.Page2@c47ee4
Page2 init() testjsf.Page2@c47ee4
Page2 preprocess() testjsf.Page2@c47ee4
Page2 button action testjsf.Page2@c47ee4
Page1 constructor testjsf.Page1@66da50
Page1 init() testjsf.Page1@66da50
Page1 prerender() testjsf.Page1@66da50
Page1 destroy() testjsf.Page1@66da50
Page2 destroy() testjsf.Page2@c47ee4
-- button on Page1 clicked
Page1 constructor testjsf.Page1@159bc95
Page1 init() testjsf.Page1@159bc95
Page1 preprocess() testjsf.Page1@159bc95
Page1 button action testjsf.Page1@159bc95
Page2 constructor testjsf.Page2@6be940
Page2 init() testjsf.Page2@6be940
Page2 prerender() testjsf.Page2@6be940
Page1 destroy() testjsf.Page1@159bc95
Page2 destroy() testjsf.Page2@6be940
TestIcefaces project uses Icefaces instead of pure JSF. It swallows some of init() and corresponding destroy() events (this behavior is inconsistent - changes from one run to antother) and all preprocess() and prerender() events. Here is the log:
-- original request to Page1
Constructor() TestIcefaces.Page1@309a10
init() TestIcefaces.Page1@309a10
destroy() TestIcefaces.Page1@309a10
-- button on Page1 clicked
Constructor() TestIcefaces.Page1@196a21e
button1_action() TestIcefaces.Page1@196a21e
Constructor() TestIcefaces.Page2@1f3305e
-- button on Page2 clicked
Constructor() TestIcefaces.Page2@199f62e
button1_action() TestIcefaces.Page2@199f62e
Constructor() TestIcefaces.Page1@15bfd47
-- button on Page1 clicked
Constructor() TestIcefaces.Page1@17a7476
button1_action() TestIcefaces.Page1@17a7476
Constructor() TestIcefaces.Page2@3a3001
-- button on Page2 clicked
Constructor() TestIcefaces.Page2@1faa3c5
button1_action() TestIcefaces.Page2@1faa3c5
Constructor() TestIcefaces.Page1@15ebf0
I attach two identical projects (see attachments to forum post http://www.icefaces.org/JForum/posts/list/7010.page) with and without Icefaces that demonstrate the problem. The project contains two pages - Page1 contains a button that takes user to Page2 and Page2 has a button that takes him back to Page1. Each event that fires writes a message to the server log. Let's look at the logs:
TestJsf project is pure JSF (doesn't use Icefaces) generates correct sequence of events:
-- original request to Page1
Page1 constructor testjsf.Page1@1ae4426
Page1 init() testjsf.Page1@1ae4426
Page1 prerender() testjsf.Page1@1ae4426
Page1 destroy() testjsf.Page1@1ae4426
-- button on Page1 clicked
Page1 constructor testjsf.Page1@9e3065
Page1 init() testjsf.Page1@9e3065
Page1 preprocess() testjsf.Page1@9e3065
Page1 button action testjsf.Page1@9e3065
Page2 constructor testjsf.Page2@710a3b
Page2 init() testjsf.Page2@710a3b
Page2 prerender() testjsf.Page2@710a3b
Page1 destroy() testjsf.Page1@9e3065
Page2 destroy() testjsf.Page2@710a3b
-- button on Page2 clicked
Page2 constructor testjsf.Page2@c47ee4
Page2 init() testjsf.Page2@c47ee4
Page2 preprocess() testjsf.Page2@c47ee4
Page2 button action testjsf.Page2@c47ee4
Page1 constructor testjsf.Page1@66da50
Page1 init() testjsf.Page1@66da50
Page1 prerender() testjsf.Page1@66da50
Page1 destroy() testjsf.Page1@66da50
Page2 destroy() testjsf.Page2@c47ee4
-- button on Page1 clicked
Page1 constructor testjsf.Page1@159bc95
Page1 init() testjsf.Page1@159bc95
Page1 preprocess() testjsf.Page1@159bc95
Page1 button action testjsf.Page1@159bc95
Page2 constructor testjsf.Page2@6be940
Page2 init() testjsf.Page2@6be940
Page2 prerender() testjsf.Page2@6be940
Page1 destroy() testjsf.Page1@159bc95
Page2 destroy() testjsf.Page2@6be940
TestIcefaces project uses Icefaces instead of pure JSF. It swallows some of init() and corresponding destroy() events (this behavior is inconsistent - changes from one run to antother) and all preprocess() and prerender() events. Here is the log:
-- original request to Page1
Constructor() TestIcefaces.Page1@309a10
init() TestIcefaces.Page1@309a10
destroy() TestIcefaces.Page1@309a10
-- button on Page1 clicked
Constructor() TestIcefaces.Page1@196a21e
button1_action() TestIcefaces.Page1@196a21e
Constructor() TestIcefaces.Page2@1f3305e
-- button on Page2 clicked
Constructor() TestIcefaces.Page2@199f62e
button1_action() TestIcefaces.Page2@199f62e
Constructor() TestIcefaces.Page1@15bfd47
-- button on Page1 clicked
Constructor() TestIcefaces.Page1@17a7476
button1_action() TestIcefaces.Page1@17a7476
Constructor() TestIcefaces.Page2@3a3001
-- button on Page2 clicked
Constructor() TestIcefaces.Page2@1faa3c5
button1_action() TestIcefaces.Page2@1faa3c5
Constructor() TestIcefaces.Page1@15ebf0
There are two separate issues here - most likely having different causes:
1. init/destroy not always firing when needed (inconsistent behavior)
2. other lifecycle events never firing at all
I spent some time looking at init/destroy issue. Seems like the page bean doesn't always get added to the servlet request attribute map. If it does, the listener handles delivery of the init event to the bean correctly. Also in case it is added and init is fired, i always see corresponding destroy firing ok.