视图构建时间是多少? [英] What's the view build time?

查看:151
本文介绍了视图构建时间是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对JSF还是很陌生,并且阅读了一些诸如这个这样的堆栈答案, 查看构建时间 的概念.考虑一下JSF生命周期方案:

I'm pretty new to JSF and reading some of the stack-answers like this one, I faced with the concept of view build time. Consider the JSF lifecycle scheme:

如您所见,没有一个阶段称为 查看构建时间 .也许它与 还原视图 阶段的含义相同?从 JavaEE教程

As you can see, there's no phase called view build time. Maybe it means the same as Restore view phase? From the JavaEE tutorial

在此阶段,JavaServer Faces实现将构建视图 页面[...]

During this phase, the JavaServer Faces implementation builds the view of the page [...]

推荐答案

视图构建时间不是一个阶段.视图构建时间是基于实例声明(通常在XHTML或JSP文件中定义)构建物理UIViewRoot实例及其所有子代的时刻.

The view build time is not a phase. The view build time is that moment when the physical UIViewRoot instance and all of its children is built based on the view declaration, which is usally defined in XHTML or JSP files.

视图构建时刻不限于特定的JSF生命周期阶段.从技术上讲,它可以在任何阶段发生.默认情况下,它确实通常在还原视图阶段执行,但也可以在渲染响应阶段执行,特别是在请求是GET请求或在POST请求期间进行导航时.开发人员还可以通过

The view build time moment is not restricted to a specific JSF lifecycle phase. It can technically happen in any phase. By default, it's indeed usually executed during the restore view phase, but it can also happen during the render response phase, specifically when the request is a GET request, or when navigation has taken place during a POST request. Developers can also programmatically build the view via ViewDeclarationLanguage#buildView(), or implicitly force the JSF implementation to do that via FacesContext#setViewRoot(), when navigation isn't sufficient for the specific task.

还原视图阶段只是将JSF状态还原到视图中. IE.它使用相同视图上的上一个请求期间的值来设置组件属性.这样,JSF可以准确地知道将表单提交给最终用户时的视图外观,并且可以采取其他措施来防止篡改请求.

The restore view phase just restores the JSF state into the view. I.e. it sets the component attributes with values as they were during the previous request on the same view. This way JSF knows exactly how the view looked like at the moment the form was being presented to the enduser and can among others do some safeguards against tampered requests.

  • How does the 'binding' attribute work in JSF? When and how should it be used?
  • creating jsf view/Component tree from the xhtml file
  • JSF 2 Global exception handling, navigation to error page not happening
  • Why JSF saves the state of UI components on server?

这篇关于视图构建时间是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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