0

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Farhan stands with Palestine
  • 13,890
  • 13
  • 58
  • 105
  • I guess your concrete question boils down to this: http://stackoverflow.com/q/11277366 – BalusC Apr 18 '16 at 07:18
  • @BalusC: Absolutely no, Bauke. I know those things very well. What I am asking here is that when there is no redirection, & on performing navigation from index.xhtml to result.xhtml, the contents of result.xhtml will be reflected in the browser window without the current URL(i.e for result.xhtml). To render this view(result.xhtml), it must have gone through lifecycle phases. Where are those? I mean phase listener didn't get fired or else it must have been shown in the console/ – Farhan stands with Palestine Apr 18 '16 at 07:24
  • The lifecycle is request based not view based. A redirect creates a new request (as explained in link). – BalusC Apr 18 '16 at 07:27
  • @BalusC: Yes, that was something I was looking for, which indeed didn't hit my mind. – Farhan stands with Palestine Apr 18 '16 at 07:29

1 Answers1

0

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:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555