my dog learned polymorphism*
The moose likes JSF and the fly likes between the render response and apply request value phases Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "between the render response and apply request value phases" Watch "between the render response and apply request value phases" New topic
Author

between the render response and apply request value phases

massimo tarantelli
Ranch Hand

Joined: Jun 19, 2012
Posts: 35

Hello again....today i'm try to clarify some doubts that I have...
I don't understand if, after the render responce, the apply request value phase start immediately or after the click on some button (like a commandButton).
I thought that the apply phase started afther a click to let jsf save all the values in the view tree in the same time.
Anyway i've noticed that setting to true the attribute immediate is possible to make some changes to the webpage (so to the view tree) without click any buttons.
I know that in this case is like the validation phase for that element starts during the apply request value phase...so it seems that the apply value phase starts without pressing any button....
thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16065
    
  21

Web-based apps don't work like ordinary GUI apps. Among other things, they do things in batches, not in discrete events, and buttons and links are not directly wired to the server, so clicking on a button doesn't do anything with any server code (including the JSF lifecycle), it simply fires off a batch (form) request that gets sent to the server, which runs the request through the JSF lifecycle, generating a response that gets sent back as a batch to the client, after which everything becomes quiet until the next request is made.

I think that one reason so many people misuse listeners in JSF is because they think that listeners fire off immediately, and they don't. They simply monitor events that come in as part of a batch request. Even AJAX requests are still request/response batches, just batches whose scope has been limited to part of the form going down and parts of the page coming back.


Customer surveys are for companies who didn't pay proper attention to begin with.
massimo tarantelli
Ranch Hand

Joined: Jun 19, 2012
Posts: 35

I'm a little confused...in this case when i can say that the apply request value phase starts?
when I click commandButton in a form?
For the whole view of the listners behaviour i think that I have to read a guide.
thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16065
    
  21

All the button does is tell the client to submit the form to the server.

When the form is submitted, the URL request is decoded by the server and routed to the FacesServlet. The FacesServlet then runs through all of the JSF lifecycle phases, or as many of them as apply, since things like invalid data and immediate requests bypass some of them. The final step is the one in which the request response is assembled (rendered) and sent back to the client.

At no time do any controls directly interact with any JSF lifecycle phases.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: between the render response and apply request value phases