Announcement Announcement Module
Collapse
No announcement yet.
Roo, MVC, Web Flow, what to choose? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Roo, MVC, Web Flow, what to choose?

    Hi,

    I just started with Spring and used Roo to create an application and start to learn how it works. It is all very neat and nice, but now I would like to customize things.

    e.g: I have a company entity which should have at least one contact person associated to it.
    So instead of having a way to create my contact person via the menu and a form on its own, I would like to create it when creating a company. So that it will be in the same form but still an entity of its own.

    My Problem is, that I do not know where to start. Can I achieve this simply by using Spring MVC? Should I use Web Flow? Can Spring MVC and Web Flow be used to together or are they mutually exclusive?

    kind regards
    tbender

  • #2
    The way I'd do that is to use the controller class command to create a new class, and the class command to make a new form backing object. I'd then add some fields into my new class, one for the company and one for the employee. I'd then make a JSP (or more likely copy the contents of the Roo-generated JSPs for contact and company and merge them together). Then write a controller method inside the recently-created controller class. Put differently, I'd use Spring MVC to produce a new form-based controller that has a form backing object that contains both of the objects I need the user to enter. In the handle method I'd just use the methods Roo introduces to the Company and Contact entities to manage their persistence.

    You don't need Web Flow for this sort of use case, although you could use it if you liked. Using Web Flow would make sense if you wanted to have the user enter the data on two separate pages (ie they click submit after entering company data, and again they click submit after entering the contact's data). You can easily do the same thing with Spring MVC if this style of user interaction is desired. The Web Flow approach would be attractive if you have a reasonable number of steps required and wanted the ability to go backwards and forwards within them. Roo supports Web Flow and you can use it in the same application as you use Spring MVC.

    HTH
    Ben

    Comment


    • #3
      Integrating this process into a Roo application...

      Originally posted by Ben Alex View Post
      The way I'd do that is to use the controller class command to create a new class, and the class command to make a new form backing object. I'd then add some fields into my new class, one for the company and one for the employee. I'd then make a JSP (or more likely copy the contents of the Roo-generated JSPs for contact and company and merge them together). Then write a controller method inside the recently-created controller class. Put differently, I'd use Spring MVC to produce a new form-based controller that has a form backing object that contains both of the objects I need the user to enter. In the handle method I'd just use the methods Roo introduces to the Company and Contact entities to manage their persistence.
      Ben, I am interested in adopting this technique for my own project. Can you tell me what details are necessary for exposing my JSP to spring Roo? Do I need to create/modify a view.xml file to create a new tile for this custom JSP?

      Thanks!

      Comment

      Working...
      X