>From: René Zanner <[EMAIL PROTECTED]>
>
> Hello,
>
> I try to use the full HTML views provided by Clay - if possible without the
> need
> for additional component definition(s) in XML.
> When defining converters (e.g. a DateTimeConverter) like the following:
>
>
><span jsfid="outputText" value="#{row.date}">
> <span jsfid="dateTimeConverter" pattern="dd.MM.yyyy HH:mm:ss.SSS">
> 01.01.1900
> </span>
></span>
>
The html tapestry like template parsing doesn't allow you to add nested
converters, validators and listeners.
You can use the attribute "converter" if it's a simple converter that doesn't
require properties.
<span jsfid="outputText" value="#{row.date}" converter="javax.faces.DateTime">
01.01.1900
</span>
However, this converter requires custom properties. You have several options.
If you want to
stay with tapestry like templates, you will need to define a custom clay config
component.
HTML:
<span jsfid="mydate" value="#{row.date}" converter="javax.faces.DateTime">
01.01.1900
</span>
XML Config:
<component jsfid="mydate" extends="outputText">
<converter jsfid="convertDateTime">
<attributes>
<set name="pattern" bindingType="dd.MM.yyyy HH:mm:ss.SSS"/>
</attributes>
</converter>
</component>
Or, you could use the new namespace support. It would look something like this:
HTML:
<span xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:outputText value="#{row.date}">
<f:convertDateTime pattern="dd.MM.yyyy HH:mm:ss.SSS"/>
</h:outputText>
</span>
Or, yet another flavor of html namespaces:
HTML:
<span xmlns:clay="http://shale.apache.org/xml/clay">
<clay:element jsfid="outputText">
<clay:attributes>
<clay:set name="value" value="#{row.date}"/>
</clay:attributes>
<clay:converter jsfid="convertDateTime">
<clay:attributes>
<clay:set name="pattern" bindingType="dd.MM.yyyy HH:mm:ss.SSS"/>
</clay:attributes>
</clay:converter>
</clay:element>
</span>
> I receive the following ERRORs:
>
> 13:45:23,275 ERROR [ApplicationImpl] Could not instantiate component of type
> javax.faces.DateTime
> 13:45:23,322 ERROR [CreateComponentCommand] Cannot create Component
> renderId="118" jsfid="dateTimeConverter" componentType="javax.faces.DateTime"
> extends="dateTimeConverter" allowBody="null" facetName="null"
>
> Is there a possibility (special attribute of the , special configuration)
> to add converters/validators/actionListeners and so on via a pure HTML view
> or
> do I have to define the component in a clay-config.xml file and add the
> converters there?
>
> Thank you very much,
>
> René
Gary