What is Restore View Phase in JSF LifeCycle?

RestoreView is the first phase in the JSF lifecycle. This phase is used for constructing view to display in the front end. Every view has it's own view id and it is stored in the FacesContext's session object. JSF View is collection of components associated with its current state. There is two types of state saving mechanism,

1)Server
2)Client

Default value is server. If you specify state saving method as server, the state of each components will be stored in the server. If it is client, it will be stored in the client side as hidden variables. This value is configured in web.xml as follows:


<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

Next we will see how FacesServelt construct the view. FacesServlet is the controller servlet in JSF where all the requests will be redirected. when first time JSP page is accessed, FacesServlet will look for whether the view is already exist. If the requested view doesn't exist, then it will create the new view(here creating view means saving the state of all components and store it in the FacesContext) and send the response. When the same JSP is accessed second time, FacesServlet will use the existing view and apply the new request values(apply request values is another phase in the lifecycle) to all the components.

PAGE scope means a hashmap that is stored in the JSF ViewRoot, it's for a particular page, for a particular user (even bound to request/response cycles), and it's not stateless.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值