Hello,

thanks for the quick response! I decided to go with the xml configuration file 
and did something similar you proposed using an extended "outputText":

  <component jsfid="my:outputDateTime" extends="outputText">
        <converter jsfid="dateTimeConverter">
                <attributes>
                        <set name="pattern" value="@pattern" />
                </attributes>
        </converter>
  </component>

For a more generalized approach I used the symbol "@pattern" rather like a 
hard-coded value for the pattern attribute of the converter. This way I'm able 
to fully re-use this component for other pattern styles:

<span jsfid="my:outputDateTime" pattern="dd.MM.yyyy">#{myView.date}</span>

or

<span jsfid="my:outputDateTime" pattern="HH:mm:ss.SSS">#{myView.time}</span>


Cheers,

René

----- Original Message -----
From: Gary VanMatre
[mailto:[EMAIL PROTECTED]
To: [email protected]
Sent: Wed, 26 Jul
2006 18:41:18 +0200
Subject: Re: How to define
converter/validator/actionListener in Clay's full HTML view without XML
configuration?


> >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
> 

Reply via email to