java – JSF:初始请求和回发请求?

请看下面这行JSF中的代码

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

来自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.

我不知道我理解初始请求与回发请求。客户端浏览器是否向Web服务器发出两个不同的请求?

初始请求是浏览器为了显示带有$ {customer.name}标签的页面的请求。回传发生在浏览器发布一些或所有页面值时,然后将首先发布的同一页面返回给客户端。这可能是由于验证错误而发生的。

知道正在呈现的当前视图是否是回发的结果是有用的。例如,您可能希望显示邮件作为回发的结果,但不是每次刷新页面。

翻译自:https://stackoverflow.com/questions/2822883/jsf-initial-request-and-postback-request

转载注明原文:java – JSF:初始请求和回发请求?