Announcement Announcement Module
No announcement yet.
What is up with Spring business objects? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • What is up with Spring business objects?

    I am new to Spring but not to MVC or java dev.

    What is up with business objects? Spring configurations bind forms to bean objects in a one to one mapping. There should be a one to many mapping between a business object and forms.

    Take for example an object Person. I may want to implement several forms to manipulate Person. I may have a form to edit, to view, to partially edit, to partially view, etc etc. Yet in the Spring XML file, I can only bind one form and validator to a BO (see below).

    <bean id="personValidator" class="com.myapp.PersonValidator"/>
    <bean id="personForm" class="com.myapp.PersonFormController">
    <property name="sessionForm"><value>true</value></property>
    <property name="commandName"><value>person</value></property>
    <property name="commandClass">
    <property name="validator"><ref bean="personValidator"/></property>
    <property name="formView"><value>person</value></property>
    <property name="successView">

    While this is of course an outgrowth of an old java model, I see little improvement here from standard servlet MVC or Struts.

  • #2
    What's stopping you from declaring several controllers to the same business object? Try adding a 2nd controller bean using the same command class element and it will work fine.