• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF life cycle

 
MaheshS Kumbhar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If any conversion errors occur during apply request values phase, these errors are queued to FacesContext.
My question is if conversion error occurs for any component, then even though it has failed conversion, does it still go to Validation phase to validate the value?
 
Christian Nicoll
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If an conversion error occurs then you 'll skip the next phases (validation, update model values, invoke application) and you'll go directly to the render response phase.

 
MaheshS Kumbhar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Christian for your valuable reply
So from the figure, does this mean the first place where conversion/validation fails, it skips the next phases and directly go to response phase?
 
Tim Holloway
Saloon Keeper
Posts: 18359
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSF is very protective. It doesn't want half-processed data. It's either supposed to be all clean or the whole process is aborted.

Validation occurs first. That is where you would normally determine that the data is OK. If not, stop right there.

Conversion is expected to be working with valid data. Although errors can occur here, if they do, it's an indication that validation wasn't really doing its job.

Only after validation and conversion have completely finished without incident will the JSF process attempt to apply updates to the backing bean(s). If an exception occurs within the apply update phase, that's an application bug.

After the updates have completed, the action processor(s), - if any - are invoked.

Finally, the results of all of the above will be used to update the View.

Just like the flowchart says.
 
Christian Nicoll
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

you've written that
Validation occurs first
and that
Conversion is expected to be working with valid data
.

I think that this sequence (validation before conversion) is wrong. My understanding is that Conversion occurs first, and that Validation will only work with converted data.

From http://www.ibm.com/developerworks/library/j-jsf3/ :


Best regards,
Christian
 
Tim Holloway
Saloon Keeper
Posts: 18359
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm. OK. that would make sense if it was value validation instead of input text validation.

Either way, both validation and conversion have to succeed for ALL items or the bean won't update and the action method(s) wont fire.
 
Christian Nicoll
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a difference between a "value validation" and an "input text validation" ?
 
Abhishek Ralhan
Ranch Hand
Posts: 40
Chrome Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think there is any difference between a "value validation" and an "input text validation", and according to me these both are same.
Please reply if anybody has a better answer..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic