This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes JSF Lifecycle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF Lifecycle" Watch "JSF Lifecycle" New topic
Author

JSF Lifecycle

Tushar Kherde
Ranch Hand

Joined: Apr 28, 2006
Posts: 56
Hi All,

I am using JSF, but it seems problem with the lifecycle, only backing beans getters are getting called not the setters. I mam skipping validation phase using immediate="true" in command button.

I am adding data into the table using add() method. this method is getting called but the fields are null.

<t:commandButton styleClass="ice_form_button" value="#{fiboproperty.settlementadd_add_label}" action="#{settlementadd.add}" id="settlementaddaddvisibleaction" immediate="true" />


Can any body tell me what could be the possible reasons for it.
If need more clarification just mention.

Thanks in Advance

Regard,
Tushar


Tushar
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
It might be worth reading the http://balusc.xs4all.nl/srv/dev-jep-djl.html to get some insight in the JSF lifecycle. If you want to use immediate="true" in the UICommand component, then only the UIInput fields which also uses immediate="true" will be set to the backing bean.
Tushar Kherde
Ranch Hand

Joined: Apr 28, 2006
Posts: 56
Hi Bauke,

This is really good stuff you have given thanks.
Tushar Kherde
Ranch Hand

Joined: Apr 28, 2006
Posts: 56
Hi Bauke,


I have implemented LifeCycleListener and each Phase is getting called multiple times and nesting of same phase is there. I am unable to explore the reason for it What is the significane of it.

Following is the logger for the same

APPLY_REQUEST_VALUES(2)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:19) - AfterPhase: APPLY_REQUEST_VALUES(2)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:14) - BeforePhase: PROCESS_VALIDATIONS(3)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:14) - BeforePhase: PROCESS_VALIDATIONS(3)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:19) - AfterPhase: PROCESS_VALIDATIONS(3)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:19) - AfterPhase: PROCESS_VALIDATIONS(3)
UPDATE_MODEL_VALUES(4)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:14) - BeforePhase: UPDATE_MODEL_VALUES(4)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:19) - AfterPhase: UPDATE_MODEL_VALUES(4)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:19) - AfterPhase: UPDATE_MODEL_VALUES(4)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:14) - BeforePhase: INVOKE_APPLICATION(5)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:14) - BeforePhase: INVOKE_APPLICATION(5)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:19) - AfterPhase: INVOKE_APPLICATION(5)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:19) - AfterPhase: INVOKE_APPLICATION(5)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:14) - BeforePhase: RENDER_RESPONSE(6)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:14) - BeforePhase: RENDER_RESPONSE(6)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:19) - AfterPhase: RENDER_RESPONSE(6)
[Nov 25 10:54:21] INFO (LifeCycleListener.java:19) - AfterPhase: RENDER_RESPONSE(6)
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
This is unusual behaviour. I can't find an explanation.

But did setting immediate="true" in the appropriate UIInput elements solve the problem?
Tushar Kherde
Ranch Hand

Joined: Apr 28, 2006
Posts: 56
Hi Bauke,

Thanks for your reply, Yes i am using immediate="true" in the appropriate UIInput elements.

It is also calling myConverter an myValidator for that UIInput but it is not updating the model values.

I am using FacesContex to read the value but i think this is not the proper way.

Any Suggession.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JSF Lifecycle
 
Similar Threads
ValueChangeListener question
No Required validation in xhtml + JSF
JSF Phase:UPDATE_MODEL_VALUES
JSF -ActionListener method
JSF + AJAX partial rendering redundent method call