Announcement Announcement Module
Collapse
No announcement yet.
What is up with Spring business objects? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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">
    <value>com.myapp.business.Person</value>
    </property>
    <property name="validator"><ref bean="personValidator"/></property>
    <property name="formView"><value>person</value></property>
    <property name="successView">
    <value>personAdded.htm</value>
    </property>
    </bean>

    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.

    Comment

    Working...
    X