加粗的部分顯示前后的變化,之所以可以這樣定義,是因為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".