Hi All,
I have a few more questions regarding JSFTemplating, but perhaps I should
first give an example of what I'm trying to do. I want to create a reusable
component which consists of other JSF components. For this purpose I need a
JSFT component which will have a tag which looks something like this:
<my:component name="Company" selectedValue="#{mybean.selectedValue}"
tableValues="#{mybean.tableValues}" />
The template for the component should look something like this (irrelevant
parts left out):
<ui:composition ...>
<h:panelGrid>
<h:outputText value="Selected #{name}" />
<h:inputText value="#{selectedValue}" />
<h:dataTable value="#{tableValues}" var="row">
<h:column>
<h:outputText value="#{row.name}" />
</h:column>
</h:dataTable>
</h:panelGrid>
</ui:composition>
I want the values which I provided to my custom component as attributes to
be forwarded to the template, taking into considerationg value bindings.
Now, I've managed to get the static text value of the 'name' attribute to
display with the following code, but it doesn't work for value expressions:
<ui:event type="beforeEncode">
if ($property{name}) {
setAttribute(key="name" value="$property{name}");
}
</ui:event>
What do I need to do in order for my template to use the value expressions,
so that it will also correctly update the bindings (if for example the user
types something into the h:inputText component, that value should be passed
on to mybean.selectedValue)?
Also, if I want to associate some default behaviour with this component, can
I use handlers for that? In this specific case I'd like to replace the
h:outputText in the table with a h:outputLink which, upon being clicked,
will update the h:inputText with the value selected. Usually I'd do this by
binding to a bean's method, but I'd like to keep it in the JSFT component to
avoid redundency.
Thank you,
Jaco