Announcement Announcement Module
Collapse
No announcement yet.
[MVC] Home made object binding Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by blaiseg View Post
    Yes, they are bound to Class. But when i say 'bean' i think 'class'.

    PropertyEditors are used to bind a object of a given class from a form value.
    OK, so yes, I agree with you

    And it sounds like you're on the right track. Writing a custom PropertyEditor isn't hard, but it's not something I can really help you do

    Look at some of Spring's Custom*Editor classes for guidance. Good luck!

    Comment


    • #17
      Thanks.

      I think at something like that for my generic editor :
      Code:
      public interface IdBeanManager {
         // I don't like that because i get an object but not the real type.
        public Object getObject(int id);
      }
       
      public class MonBeanManager implements IdBeanManager {
         private MonBeanDao dao;
         ...
         public Object getObject(int id) {
           return dao.getBean(id);
         }
      }
       
      public class GenericPropertyEditor extends PropertyEditor {
        private IdBeanManager manager;
        ...
        public Object getAstText(String text) {
          try {
            return manager.getObject(Integer.parseInt(text));
          } catch (...) { .. }
        }
      }

      Comment

      Working...
      X