JSF Lifecycle

 

The life cycle handles both kinds of requests: initial requests and postbacks. When a user makes an initial request for a page, he or she is requesting the page for the first time. When a user executes a postback, he or she submits the form contained on a page that was previously loaded into the browser as a result of executing an initial request. When the life cycle handles an initial request, it only executes the restore view and render response phases because there is no user input or actions to process. Conversely, when the life cycle handles a postback, it executes all of the phases.

 

1.  Restore View

 

builds the view root and saves to FacesContext, includes event handlers and validators

if it is the initial reqeust, empty view created and life cycle advances to render response directly.

 

2. Apply Request Value

 

component extracts its new value from the request parameters. Type conversion occurs in this phase.

 

if renderResponse called on FacesContext, skip to the render response phase.

 

 FacesContext.responseComplete can be called, and redirect to a different web app

 

if immediate set to true, the validation, conversion,events will be processed in the phase.

 

3. Process Validations

 

process validators registered on the components. if any error message, the life cycle advances directly to the render response phase.

 

if FacesContext.renderResponse called, skip to the render response phase

 

if FacesContext.responseComplete called, redirect to a different web app

 

4. Update Model value

 

update component value to manage bean property

 

similarily for FacesContext.responseComplete

similarily for FacesContext.renderResponse

 

5. Invoke Application

 

handle application-level events

 

similarily for FacesContext.responseComplete

 

 

6. Render Response

 

if JSP pages used, the components will render themselves as the JSP container traverses the tags in the page.

 

if this is the initial request, the components represented on the page will be added to the component tree as the JSP container executes the page.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值