request processing lifecycle

本文详细介绍了JavaServer Faces (JSF) 中的请求处理生命周期,包括从视图恢复到响应渲染的各个阶段。关键阶段如应用请求值、验证过程、更新模型值等会生成消息。此外,还探讨了事件监听器的作用及其如何影响处理流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The Request Processing Lifecycle. Flows with dotted lines are
optional. JSF cycles through several phases as it processes each request.
After each phase, event listeners are called. Listeners can either continue
as normal, report errors and skip to the Render Response phase, or generate
the response themselves.

After most phases, JSF will broadcast events to any interested listeners (events
can be associated with a particular phase). Event listeners perform application
logic or manipulate components; they can also jump to the final phase, Render
Response. A listener can even skip the final phase and render a response itself. It
might do this if it were returning binary content, performing a redirect, or returning
other content that isn’t related to JSF, like XML documents or ordinary HTML.

Four of these phases can generate messages: Apply Request Values, Process                                     Validations, Update Model Values, and Invoke Application. With or without messages,
it is the Render Response phase that sends output back to the user, unless
a listener, renderer, or component has sent the response itself.

Phase Description Events fired
Restore View Finds or creates a tree of components for the selected
view. Some components, like HtmlCommandButton, will
generate action events (or other types of events) in this
phase.
Phase events
Apply Request Values Updates the value of the components to equal ones sent
in the request, optionally using converters. Adds conversion
errors if there is an error. Also generates events from
request parameters.
Phase events, data
model events,
action events
Process Validations Asks each component to validate itself (which may
include using external validators). Validation error messages
may be reported.
Phase events, data
model events,
value-change
events
Update Model Values Updates all the values of backing beans or model objects
associated with components. Conversion error messages
may be reported.
Phase events, data
model events,
Invoke Application Calls any registered action listeners. The default action
listener will also execute action methods referenced by
command components (like HtmlCommandButton) and
choose the next view to be displayed.
Phase events,
action events
Render Response Displays the selected view using the current display technology
(like JSP).
Phase events

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值