JSF:初始请求和回发请求? [英] JSF: initial request and postback request?

查看:77
本文介绍了JSF:初始请求和回发请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请在JSF中的以下代码行中查看

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

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

来自java.sun.com的报价:

Quote from java.sun.com:

对于包含此标记的页面的初始请求,JavaServer Faces实现在生命周期的呈现响应阶段评估#{customer.name}表达式.在此阶段,表达式仅从客户bean访问name的值,就像在立即评估中所做的那样.

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.

对于回发请求,JavaServer Faces实现在生命周期的不同阶段评估表达式,在此过程中,从请求中检索值,对其进行验证并传播到客户Bean.

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服务器发出两个不同的请求?

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

推荐答案

初始请求是浏览器为了显示带有${customer.name}标记的页面而执行的请求.当浏览器发布一些或所有页面值,然后将最初发布的同一页面返回给客户端时,发生回发.例如,可能由于验证错误而发生这种情况.

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.

这篇关于JSF:初始请求和回发请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆