[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-3551) Seam can not convert java.util.Date, it ignores javax.faces.convert.DateTimeConverter

Francisco Jose Peredo Noguez (JIRA) jira-events at lists.jboss.org
Mon Oct 13 14:50:30 EDT 2008


    [ https://jira.jboss.org/jira/browse/JBSEAM-3551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12433645#action_12433645 ] 

Francisco Jose Peredo Noguez commented on JBSEAM-3551:
------------------------------------------------------

So, the reason this is not working as expected is because in jjsf-ri-runtime.xml inside jsf-impl.jar it has:

<converter>
    <converter-id>javax.faces.DateTime</converter-id>
    <converter-class>javax.faces.convert.DateTimeConverter</converter-class>
  </converter>

But it does not have:

<converter>
    <converter-for-class>java.util.Date</converter-for-class>
    <converter-class>javax.faces.convert.DateTimeConverter</converter-class>
  </converter>

Interesting... I guess the workaround will be to modify Seam-gen so that in includes a pre-configured converter for java.util.Date in components.xml? (or in faces-config.xml?) in Seam next release?

> Seam can not convert java.util.Date, it ignores javax.faces.convert.DateTimeConverter
> -------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-3551
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3551
>             Project: Seam
>          Issue Type: Bug
>    Affects Versions: 2.0.2.SP1
>         Environment: Jdk 1.5. Tomcat 6.0.18, Jboss Tools 2.1.2
>            Reporter: Francisco Jose Peredo Noguez
>            Assignee: Dan Allen
>         Attachments: SeamTestCase.zip
>
>
> Create a Seam project using  Jboss Tools 2.1.2.
> Create a new Seam Form with name "SeamDateForm"
> Open the file SeamDateForm.java and change the value from Integer to java.util.Date.
> Right-click seamDateForm.xhtml and click Run As... -> Run On Server.
> Write something in the form (like for example some random string "dfasdf")
> You will get the error: Conversion Error setting value 'dfasdf' for 'null Converter'. 
> Now create a Date Converter, as the one included in the attached test case project (BTW it inherits from javax.faces.convert.DateTimeConverter).
> Stop the application (just to be 100% sure everything gets loaded correctly)
> Again:
> Right-click seamDateForm.xhtml and click Run As... -> Run On Server.
> Write something in the form (like for example some random string "dfasdf")
> Now you get the right error: value must be a date, eg. 10/13/2008.
> Of course it not only fails when you write a random string, even if you write a correct date, like 01/01/2001, you will get an error that says: Conversion Error setting value '01/01/2001' for 'null Converter'. But if you write your own converter (for example inheriting from javax.faces.convert.DateTimeConverter) everything works fine.
> I think Seam should use javax.faces.convert.DateTimeConverter by default, I shouldn't need to create my own converter.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list