加粗的部分显示前后的变化,之所以可以这样定义,是因为Insert组件定义value参数的默认绑定类型为ongl.
注意:默认的绑定参数总是可以被显式的绑定声明覆盖掉。
如果没有定义默认的绑定参数,那么在html模板中定义的默认绑定参数为literal,页面定义文件里的默认绑定参数为ognl
Tapestry 4.0 introduces a new idea: default binding types. Each component parameter may define a default binding type (using the default-binding attribute of the element).
If a binding reference does not have a prefix, the default binding type is used.
Because of this, the following two snippets are identical:
This works because the Insert component defines the default-binding for the value parameter to be "ognl". Likewise, the source and value parameters of the Foreach component are defined to be "ognl". However, the element parameter of the Foreach component has a binding type of "literal".
This is a decision made by the component author. If a particular parameter is (nearly) always bound using a particular binding type, then a default-binding may be set. The default binding can always be overriden with an explicit binding type prefix.
What about parameters that don't define a default binding type? The answer to this question (which includes all informal parameters), is that it depends on whether the parameter is bound in an HTML template, or in a page or component specification. In an HTML template, the default binding type is "literal". In a specification, the default binding type is "ognl".