恢复视图阶段,描述不当之处敬请指正。
恢复视图阶段流程走向,见流程图。
关键代码段:
1.restoreViewSupport.processComponentBinding(facesContext,viewRoot);//组件树解析
2._invokeViewRootAfterPhaseListener(facesContext);//ViewRoot后阶段el方法执行
3. StringviewId = restoreViewSupport.calculateViewId(facesContext);//计算请求视图
4. //计算目标视图
viewRoot =viewHandler.restoreView(facesContext, viewId);
String calculatedViewId =getViewHandlerSupport(context).calculateViewId(context, viewId);
viewId = handleSuffixMapping(context,viewId);//真实资源名称
String[] faceletsViewMappings =_initialized ? _faceletsViewMappings : getFaceletsViewMappings(context);//获取支持FACELETS语言的配置资源后缀
ViewDeclarationLanguage vdl =viewHandler.getViewDeclarationLanguage(facesContext,
restoreViewSupport.deriveViewId(facesContext, viewId));//查找解析语言
return strategy.getViewDeclarationLanguage();//文件后缀判断并返回当前语言解析器
//有用参数
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml .jsp .ui</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
<param-value>*.xhtml;*.usl</param-value>
</context-param>