On 2/22/07, Hasan Turksoy <[EMAIL PROTECTED]> 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:
   <converter>
       <converter-id>javax.faces.DateTime</converter-id>
       <converter-class>javax.faces.convert.DateTimeConverter</converter-class>
   </converter>


that is just the id...

I think the -for-class is only there for "simple" converters like

javax.faces.convert.FloatConverter

-M


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;
<h:inputtext ...>
  *<f:convertDateTime dateStyle="short" />*
  <s:commonsvalidator type="required" arg="..." client="true" server="true"
/>
</h:inputtext>

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 <[EMAIL PROTECTED]> wrote:
>
> >From: "Hasan Turksoy" <[EMAIL PROTECTED]>
> >
> > 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;
> >
> >
> ><h:inputtext ...>
> >  <f:convertDateTime dateStyle="short" />
> >  <s:commonsvalidator type="required" arg="..." client="true"
> server="true"
> >/>
> ></h:inputtext>
> >
> > 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