Hi,

Why not simply do:

Public class MyConverter implements Converter
{
        private static final int LENGTH = 40;
...
...
}


Guy.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 10, 2008 10:57 AM
To: MyFaces Discussion
Subject: Re: How to set a converter default property?

[EMAIL PROTECTED] schrieb:
> Hi, i try to set a default property for a converter in this way:
> <validator>
>    <validator-id>xyValidtor</validator-name>
>    <validator-class>com.xy.XyValidator</validator-class>
>    <property>
>       <property-name>length</property-name>
>       <property-class>java.lang.Integer</property>
>       <default-value>40</default-value>
>    </property>
> </validator>
>
> I expected that setter-Methode of my Member length in the 
> XyValidator-Class will called, but only the
> default Constructor is called, so why fails my setting of a 
> Default-Property?
>
The JSF standard does not support this. When defining a validator in a 
faces-config.xml file, the only supported xml elements are validator-id 
and validator-class.

What you can do is use the validator attribute available on all input 
elements:
 <h:inputText validator="#{....}" .../>

That EL expression can then get an object from your "managed beans" 
definitions, which does support setting properties etc.

Regards, Simon

Reply via email to