Hi Sergey,
>I have got a problem with updating model when clay based component is used.
>As a test case I have two pages. On the first page I ask for name. Then, on
>the
>second page, I print it.
>
>When I have on the first page:
> <h:form>
> <h:inputText value="#{myuser.firstName}"/>
> <h:commandButton value="Show It" action="outp"/>
> </h:form>
>
>Everything works properly. However, when I replace inputText with clay style:
>
> <h:form>
> <sh:clay jsfid="inputName" id="comp"/>
> <h:commandButton value="Show It" action="outp"/>
> </h:form>
>
>It shows the init value from the bean, but does not update the bean when the
>changed value is submitted.
>
>clay-config.xml has:
>
> <component jsfid="inputName" extends="inputText" allowBody="false">
> <attributes>
> <set name="value" value="#{myuser.firstName}"/>
> </attributes>
> </component>
>
>faces-config.xml has:
>
>...
> <managed-bean>
> <managed-bean-name>myuser</managed-bean-name>
> <managed-bean-class>demo.User</managed-bean-class>
> <managed-bean-scope>request</managed-bean-scope>
> <managed-property>
> <property-name>firstName</property-name>
> <property-class>java.lang.String</property-class>
> <value>John</value>
> </managed-property>
> </managed-bean>
>...
>Actually, I incorporated those test stuff inside the shale-use-case
>application
>(07/08/05 nightly build). So, the rest configuration is from the original
>shale-use-case environment.
You should look in the use case builds after 7/10. Craig applied a patch to
the rolodex example late Sat. having HTML tapestry like templating.
Presently, the HTML templating has to be included as a subtree within a JSP
page. I'm near to posting a bugzilla ticket with a clay view handler that will
allow for full html view templating :-)
>
>Do I miss something important here?
Try adding the "userValueLateBinding" attribute to the "set" node.
This attribute, tells clay to pass a ValueBinding object to the target
component. Otherwise, the resulting literal expression will be passed. I'm
guess that your navigation rule is not a redirect since your bean is in request
scope.
For some of the base components like the outputText, this attribute is set as a
default. This means that all components that extend "outputText" will inherit
the default attribute with the name of "value" having "userValueLateBinding"
set to "true".
The default clay configuration file, view-config.xml, can be found in META-INF
of the shale-clay.jar.
There is a similar attribute, "useMethodLateBinding" for method binding. The
basis for these attributes is that there is a predefined contract between a
component's JSP tag and the corresponding faces component. Since Clay is a
stand-in for the JSP faces tags, these attributes allow you to specify what get
passed to the component's properties - as an expression object or a literal
value.
<component jsfid="inputName" extends="inputText" allowBody="false">
<attributes>
<set name="value" useValueLateBinding="true"
value="#{myuser.firstName}"/>
</attributes>
</component>
Gary
>
>--
>Sergey