Results 1 to 2 of 2

Thread: Property Editors

  1. #1
    Join Date
    Jun 2005
    Location
    Turkey
    Posts
    7

    Default Property Editors

    Hi,

    Could some one please explain what Property Editors are used for and give some simple examples?

    Thanks.

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    PropertyEditors are used in a few places, but basically they are for converting from String to other types and back again. For example, a date can be represented as a String, and you'd use a property editor to convert it.

    This is especially useful in web requests, because the Strings in the web request can be bound directly to your command object (bypassing the need for an object like Struts ActionForms). For example:

    Code:
        protected void initBinder(HttpServletRequest request,
            ServletRequestDataBinder binder) {
    
            SimpleDateFormat dateFormat = new SimpleDateFormat("MMM-yy");
            dateFormat.setLenient(false);
            binder.registerCustomEditor(Date.class, null,
                new CustomDateEditor(dateFormat, true));
        }
    The best place to look are the reference docs. See Registering additional custom PropertyEditors.

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Unit testing with JOTM and JtaTransactionManager
    By lalle in forum Architecture
    Replies: 1
    Last Post: Oct 15th, 2005, 09:05 AM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. Replies: 4
    Last Post: Aug 17th, 2005, 04:42 AM
  5. Replies: 2
    Last Post: May 13th, 2005, 05:42 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
  •