Announcement Announcement Module
No announcement yet.
Forms: use domain objects or form beans there? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Forms: use domain objects or form beans there?


    just a simple design question I am not pretty sure about...

    Do you rather use your domain objects for the form backing objects or do you implement own form beans and push the data through to your domain objects?

    Both approaches seem to fit and have their own advantages, but what is the standard design approach here and why?

    thx & cu

  • #2
    There is no real standard design approach. Use what fits best. I used domain objects as well as specialized form objects. As you stated both have there (dis)advantages, just pick the one which suites your needs.


    • #3
      Yes thats the way I am doing currently but there must be slight differentiations between both approaches.

      When do you use domain objects and when do form beans suit better.
      -If I am lazy and want to reuse I only use domain objects.
      -If I need some form information for different service methods I create form beans
      -If I use form beans which use a domain object and further data, I delegate data to it and also can use both on the service level

      But what is clean and what is dirty? I don't want to make a design which is "deprecated" like the XML controller configuration and must be changed soon ;-)

      I also want to try annotation based validation with At-Length and At-NotBlank and so on. This technique seems very well for form beans but should also work for domain objects.
      If I use it for domain objects I will blow up my domain objects with a lot of annotations.

      So far thank you :-)


      • #4
        How many new projects are using Struts 1 these days? Ask someone what they think of ActionForms.