Announcement Announcement Module
No announcement yet.
lost on controllers Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • lost on controllers


    This is my first week with Spring. It's been very slow going for my thick head...

    I'm coding some admin pages for this project, so let me tell you what I'm trying to do and maybe you can suggest to me how to accomplish this with Spring MVC.

    Objects: Accounts, Roles, Role_Types, Account_Roles
    1 Account -> N Roles
    1 Role -> 1 Role Type

    The Accounts page is already coded, and when editing an account, the existing roles are listed at the bottom. Each role has a radio button and there's a remove button at the bottom. Along with this there's an Assign Role button.

    When Assign Role is clicked, I open a page which lists the roles. The roles are grouped by Role Type, so there's a Role Type drop-down. When this is clicked, the page is refreshed with the Roles for that Role Type. Each Role has a checkbox (multiple selections) with an "Assign" button.

    When the assign button is used, I want to do the processing, go back to the Assign Roles page, and list a Success/Error message at the top of the page. This will allow them to continue adding new roles, until they click the Done button, which sends them back to Edit Account.

    I'm totally lost with controllers so any suggestions would be greatly appreciated. The only thing currently working is the Edit Account part (nothing pertaining to Roles is done).


  • #2
    You can either use a MultiActionController, or stick with a SimpleFormController mapped to each operation, i.e. a /list.htm, /delete.htm?role=123 and /assign.htm?account=12

    I personally go for the SFC because I think it is nicer You will also want to look at overriding referenceData in SFC.

    Also, the following might be helpful: