Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 即时和差异评估_Jsf_El - Fatal编程技术网

Jsf 即时和差异评估

Jsf 即时和差异评估,jsf,el,Jsf,El,让我们有一些facelet1.xhtml,它包含 <h:inputText id="prop" value="#{MyBean.myProperty}"/> <h:inputText id="prop" value="${MyBean.myProperty}"/> 引用官方教程: Immediate evaluation means that the expression is evaluated and the result returned as soon as

让我们有一些facelet
1.xhtml
,它包含

<h:inputText id="prop" value="#{MyBean.myProperty}"/>
<h:inputText id="prop" value="${MyBean.myProperty}"/>
引用官方教程:

Immediate evaluation means that the expression is evaluated and the result returned as soon as the page is first rendered. 

我不明白在什么特定阶段立即表达式是求值的?在
呈现响应
阶段或
更新模型值
应用请求
或什么?

本教程讨论的是遗留JSP。在JSP上使用JSF时,无论在何处声明,
${}
总是在视图构建时进行计算。这就像JSTL、标记处理程序和
id
/
binding
属性如何在JSF中工作一样。另请参见,以获得一些深入的解释

然而,在JSP的后续Facelets中,
${}
的处理方式与
#{}
完全相同。因此,
${}
评估也被推迟。为了避免您自己和Facelets代码的未来维护者之间的混淆,强烈建议您放弃在Facelets中使用
${}
,并始终坚持使用
{}

每次运行时需要延迟表达式的结果时,都会对其进行计算。对于
UIInput
组件,这是验证阶段的一次(在触发所有值更改侦听器之前,检查提交的值是否与(旧!)模型值相比发生了更改),以及渲染响应期间的一次(使用(新!)模型值生成HTML输出)。如果立即对其进行评估,则设置和获取新模型值将不起作用

另见: