views:

216

answers:

1

Please take a look at this below line of code in JSF

<h:inputText id="name" value="#{customer.name}" />

Quote from java.sun.com

For an initial request of the page containing this tag, the JavaServer Faces implementation evaluates the #{customer.name} expression during the render response phase of the lifecycle. During this phase, the expression merely accesses the value of name from the customer bean, as is done in immediate evaluation.

For a postback request, the JavaServer Faces implementation evaluates the expression at different phases of the lifecycle, during which the value is retrieved from the request, validated, and propagated to the customer bean.

I am not sure I understand initial request vs postback request. Does the client browser make two different request to the webserver?

+3  A: 

Initial request is the request that the browser does in order to display the page with the ${customer.name} tag. Postback happens when the browser posts some or all page values and then the same page that was posted in the first place is returned to the client. This might happen for example as a result of a validation error.

Knowing if the current view being rendered is a result of a postback is useful. For example you might want to display a message as a result of a postback, but not every time the page is refreshed.

Cesar