>From: René Zanner <[EMAIL PROTECTED]> > > Hello, > > comments are inline... > > > ----- Original Message ----- > From: Gary VanMatre > [mailto:[EMAIL PROTECTED] > To: [email protected] > Sent: Fri, 28 Jul > 2006 03:23:37 +0200 > Subject: Re: "binding" attribute of JSF standard > components > > > > >From: René Zanner > > > > > > Hi all, > > > > > > unfortunately the "binding" attribute isn't standard for all JSF > > components. > > > Will that change in the future? I think it's a required attribute when > > trying to > > > be conform to the JSF standard... > > > > > > > I believe that the next version of JSF, 1.2, will make the Converter, > > Listener and Validator have a binding attribute. In 1.1, it's only > > components. This will be a really nice feature. > > > > > > > > > Otherwise I'm forced to inherit from the standard components provided by > > clay > > > just to provide the "binding" attribute: > > > >> ><component jsfid="my:dataTable" extends="dataTable"> >> > <attributes> >> > <set name="binding" value="@binding" /> >> > </attributes> >> ></component> > > > > Actually, you don't have to extend an existing definition to define a new > > attribute. The inheritance you see in the default clay-config.xml is only > > taking advantage of the metadata inheritance for reuse. > > > > > > > http://svn.apache.org/viewvc/shale/framework/trunk/shale-clay/src/main/resources > > /META-INF/clay-config.xml?view=markup > > > > > > When you extend an existing "top-level" component definition, it inherits > > the attributes of it's parent definition. The attribute has three > > "attributes", name, value and bindingType. The "name" attribute is required > > but the other values will be inherited or can be overridden by the > > extending > > component definition. > > > > > Hey - that's cool that "binding" made it into the new top-level component > definition "baseComponent"! In my current version of Shale this component > definition is missing (together with the binding attribute). Maybe it was > added > only recently, but - hey! - that's developing on the edge of technology ;o) > ... >
That one is a few months old :-) > > > > > There are three enumerations of bindingType. This value tells the clay > > component how to handle attributes that contain EL. > > VB - Use Value Binding > > MB - Use Method Binding > > None - No use of EL. The value passes through > > Early - EL evaluated before setting the component property/attribute. > > Most of the component properties are value binding (VB). The method binding > > (MB) is really more for documentation. We have to know what type of > > parameters are required for MB. There are hard-coded assumptions. For > > example we know an attribute named "action" is a method binding expression. > > > > The Early type would be like a JSP tag evaluating the expression before > > it's > > passed on to the component and the None option mean not to inspect for EL, > > just pass the sting onto the component. > > > > > > > Is it possible to enforce it being a Value Binding (e.g. via > > bindingType="VB"?)? > > > Other values are not allowed since the value must refer to a UIComponent > > > attribute of a backing bean. > > > > > > > > > The attribute value of bindingType is the enforcement. It's kind of like > > the TDL in JSP terms. > > > > > By saying "enforced" I meant "enforced at runtime". So, is the bindingType > enforced at runtime? When there's no value binding given for an attribute of > bindingType "VB", I'll get an exception? > Oh ya, the binding attribute is a special case. It's assumed to be a value binding. http://svn.apache.org/viewvc/shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java?view=markup If it's not, you will see an exception: create.component.error=Cannot create Component {0} We could make this more specific? > > > The component definition is bound to the html node by jsfid (there are also > > 11 implicit mappings). Attributes in the html nodes overrides/extends > > attributes in the component definition. Attributes defined in the html node > > that are not defined in the component definition are made into symbols. > > > > > > > Without this attribute I cannot use something like this in my HTML views: > > > >> ><table jsfid="my:dataTable" binding="#{tableView.dataTable}" ...> >> > ... >> ></table> > > > > > > > > > The "binding" is required for dataTable when trying to access the > > currently > > > selected row after clicking on a command link in a specific row. In this > > case > > > the row clicked on is contained in the attribute "rowData" of the > > dataTable: > > > dataTable.getRowData() gives the Object associated with the row in which > > > occurred the mouse click. > > > > > > > Ah, that's a good tip. I never thought about handling it that way. That > > would > > make your links very clean. That's better than having to define param's. > > > > > > > Cheers, > > > > > > René > > > > Gary > > > > René Gary
