>From: "Matthias Wessendorf" <[EMAIL PROTECTED]> 
>
> On 2/22/07, Hasan Turksoy wrote: 
> > jsf-ri1.1 contains converter for "javax.faces.DateTime" class only... not 
> > for java.util.Date class.... you can download and look at 
> > jsf-ri-config.xml... 
> > 
> > in fact, this is not the main problem... i can overcome my issue by adding 
> > a 
> > converter for "java.util.Date"... But this doesn't solve the problem in the 
> > origin.... 
> 
> are you talking about this: 
> 
> javax.faces.DateTime 
> javax.faces.convert.DateTimeConverter 
> 
> 
> 
> that is just the id... 
> 
> I think the -for-class is only there for "simple" converters like 
> 
> javax.faces.convert.FloatConverter 
>

Yeah, for some reason I was thinking that the RI already has a converter 
registered by type for the java.util.Date type.

<converter-for-class>java.util.Date</converter-for-class>

The shale commons validator uses the ConverterHelper [1] (uses JSF type 
converters) to convert the submitted value, after the components converter has 
already converted to a Date object,  back to a String to match the commons 
validator methodParams.

       <validator       name="date"
                    classname="org.apache.shale.validator.CommonsValidator"
                    method="isDate"
                    methodParams="java.lang.String,java.lang.String"
                    msg="errors.date"
                   jsFunctionName="validateDate"
                   
jsFunction="org.apache.commons.validator.javascript.validateDate"   
                      depends=""/>



[1] 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-core/src/main/java/org/apache/shale/util/ConverterHelper.java?view=markup
 
> -M 
> 

Gary


> 
> > Because; in JSF, one can add custom converter for each component 
> > separately... in such a case, using my by-type java.util.Date converter is 
> > meaningless! because, user assigned a custom converter for that field!! JSF 
> > will use it instead of by-type converter... so, commons should use it 
> > too... 
> > 
> > now, when assigned custom validator for fields,, JSF RI and 
> > CommonsValidator 
> > behaving differently!!! this is not an acceptable situation! isn't it? 
> > 
> > to realize the problem... when returned to my sample in the previous post; 
> > suppose that i have a "java.util.Date" converter... and no custom 
> > converter... in this case, CommonsValidator and JSF RI will work same.. 
> > both will use our by-type converter... 
> > 
> > But, if i use a custom converter for my inputtext as below; 
> > 
> > ** 
> > > > /> 
> > 
> > 
> > then, JSF RI will use this custom component converter to convert it's value 
> > but CommonsValidator will use our by-type java.util.Date converter... 
> > different behaviours!!... 
> > 
> > In conclusion; when we look at JSF RI code, we see that; it first looks for 
> > custom component converter then, if can not find, searches for a by-type 
> > converter... CommonsValidator must work same i think... 
> > 
> > i have injected my solution into my CommonsValidator class and it works 
> > perfect... above suggestion should be implemented in original 
> > CommonsValidator releases as soon as possible i think... 
> > 
> > i can provide code if required... 
> > 
> > regards.. 
> > 
> > hasan.. 
> > 
> > 
> > 
> > 
> > 
> > On 2/21/07, Gary VanMatre wrote: 
> > > 
> > > >From: "Hasan Turksoy" 
> > > > 
> > > > hi all, 
> > > > 
> > > > Env: jsf1.1, commons-validator1.3.1, shale1.0.4.. 
> > > > 
> > > > i'am trying to put a required validator for my date entering field.. My 
> > > > field has a f:convertDateTime to make conversion between String <-> 
> > > > java.util.Date. it's like; 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > > > > server="true" 
> > > >/> 
> > > > 
> > > > 
> > > > When i entered a valid value into my date field it throws a 
> > > > ConverterException as below; 
> > > > 
> > > > "javax.faces.ConverterException: You have requested a conversion for 
> > > type 
> > > > java.util.Date, but there is no by-type converter registered for this 
> > > type." 
> > > > 
> > > 
> > > 
> > > I'm not sure why you are seeing this exception. I belive that the 
> > > java.util.Data 
> > > converter should be registered with the JSF runtime. 
> > > 
> > > Can you tell where the exception is being raised from the stack trace? 
> > > The reason for asking is that the shale commons validator uses JSF 
> > > converters to coerce data types to match the signatures of the server 
> > > side validation methods. 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > > as i understand; it needs a converter for the java.util.Date class.. 
> > > > But 
> > > in 
> > > > JSF, one can assign custom converter tags as above sample... 
> > > > 
> > > > this means, (my suggestion) commonsvalidator should get the converter 
> > > for 
> > > > that type from component. if component don't have any converters 
> > > assigned, 
> > > > it should lookup for a by-type converter then... Otherwise, i will have 
> > > to 
> > > > define by-type converters for all my component converters! this will be 
> > > > stupid i think... 
> > > > 
> > > > any comments?? or solutions?? 
> > > > 
> > > What version of the JSF runtime are you using? This sounds like a rutime 
> > > issue. 
> > > 
> > > 
> > > 
> > > > thanks in advance, 
> > > > hasan.. 
> > > 
> > > 
> > > Gary. 
> > 
> 
> 
> -- 
> Matthias Wessendorf 
> http://tinyurl.com/fmywh 
> 
> further stuff: 
> blog: http://jroller.com/page/mwessendorf 
> mail: mwessendorf-at-gmail-dot-com 

Reply via email to