Announcement Announcement Module
Collapse
No announcement yet.
CommandClass on Spring MVC Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • CommandClass on Spring MVC

    Hello,
    I'm quite new in Spring, but have a question on commandClass.

    In a typical web app, we build value beans for business logic to use. And we use those model beans in struts as form beans. Of course, some web form page requires multiple domains to be combined, so following config are coded in Struts.

    <form-bean name="formA" type="DynaActionForm">
    <form-property name="domainA" type="com.dom.D1" />
    <form-property name="domainB" type="com.dom.E1" />
    </form-bean>

    This works fine and if another one is needed, we just add another domain.

    Now, in Spring, we define commandClass that tied to only single class type and there is no where to specify more commandClasses to be added to.


    1. Is there similar functionality in Spring that just does the above?

    2. Do I have to create a new set of form beans that only used for web layer, then move each properties to domain beans?

    Thanks in advance!!!

  • #2
    2. Do I have to create a new set of form beans that only used for web layer, then move each properties to domain beans?
    In Spring you don't need form beans at all. Bind directly to your domain beans. Thats just one of the major advantages of Spring MVC over Struts.

    Comment


    • #3
      Re: CommandClass on Spring MVC

      Originally posted by jonnyS
      1. Is there similar functionality in Spring that just does the above?
      not out of the box. a simple way to do it is to create a class
      formC {
      private formA;
      private formB;
      }

      and use it as your commandClass then you ould access your properties by expressions like formC.formA.field1, formC.formB.fieldX, etc.

      Originally posted by jonnyS
      2. Do I have to create a new set of form beans that only used for web layer, then move each properties to domain beans?
      Well that was answered by 'katentim' in previous post

      HTH

      Comment

      Working...
      X