Understanding JSF Lifecycle phases with & without Redirection

Suppose there are 2 JSF pages & a backing bean

index.xhtml- with view parameters & a form

Backing bean- action method with navigation to result.xhtml from index.xhtml with NO REDIRECTION

result.xhtml- no form but outputting some text

Consider a simple case

Fire a GET request to index.xhtml-

Something like this with view parameters-

http://localhost:8080/Leonard/faces/ch2/ch2_8/index.xhtml?playernameparam=HAMZA&playersurnameparam=YOUSUF

Phases executed-

enter image description here

Response-

enter image description here

Hit Submit-

enter image description here

Phases executed-

enter image description here

NOTE: It was a POSTBACK, the lifecycle phases were executed for POST request to index.xhtml

Response-

enter image description here

The response contains the contents of result.xhtml page, which were then clearly reflected in the browser window. As it was rendered, the lifecycle must have executed for result.xhtml view too. WHY DON"T I SEE THE PHASES for this view in the console?

I know very well that with redirection, on POSTBACK, the render response phase for index.xhtml will be skipped and then all the phases for result.xhtml will be fired.

Upvotes: 0

Views: 646

Answers (1)

BalusC
BalusC

Reputation: 1108547

You seem to expect that the lifecycle is view based. This will indeed cause confusion.

In fact, the lifecycle is request based, not view based. That should clear up everything. If you think about it, it's really unnecessary to redo entire cycle of collecting, converting and validating request parameters and update model values and invoke action during the very same HTTP request.

See also:

Upvotes: 0

Related Questions