Results 1 to 3 of 3

Thread: Problem With Custom Property Editor

Threaded View

  1. #1
    Join Date
    Jun 2009
    Posts
    7

    Default Problem With Custom Property Editor -- Solved --

    I'm new comer on swf. I try to use custom property editor but not success yet.
    I have a entity BorrowingBook with two field have a Date property. I try to use propertyEditorRegistrar in my flow config look like this :

    Code:
     <bean id="borrowBookAction" class="org.springframework.webflow.action.FormAction">
            <property name="formObjectClass" value="org.kris.entity.BorrowingRecord"/>
            <property name="propertyEditorRegistrar" value="org.test.util.PropertyEditors"/>
        </bean>
    And this is my PropertyEditors implementation :
    Code:
    public class PropertyEditors implements PropertyEditorRegistrar{
    
        public void registerCustomEditors(PropertyEditorRegistry registry) {
            SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-mm-dd");
            dateFormat.setLenient(false);
            registry.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
        }
    }
    This class entity :
    Code:
    @Entity
    public class BorrowingRecord implements Serializable {
    
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private Long id;
        private String isbn;
        @Temporal(javax.persistence.TemporalType.DATE)
        private Date borrowDate;
        @Temporal(javax.persistence.TemporalType.DATE)
        private Date returnDate;
        private String reader;
    but if i try to run this code i getting error look like this :
    Code:
    Caused by: java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.springframework.beans.PropertyEditorRegistrar] for property 'propertyEditorRegistrar': no matching editors or conversion strategy found
    I don't know how to use it with proper value with my entity class property. How to use property editor for spesific value ?
    Is there another way to use it ?

    Thanks lot before...
    Last edited by nyuby; Jan 31st, 2010 at 08:06 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •