Announcement Announcement Module
No announcement yet.
This is embarrassing, why should i write one controller for one function Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • This is embarrassing, why should i write one controller for one function

    As i am using Springfreamwork to build a user loging and register web-app, i found out that i defined all **/*.nav to be handled by a navigationController, then i could not go further. the next thing i did is write all /**/userLogin.nav to be handled by a userLoginController, and so on....

    i should explain this issue in more detail,
    in order to fulfill viewing request such like showCatalog.nav or showProduct.nav etc, i have a controller dedicate to that, for all my viewing request i can reuse this controller without any problem.

    But when i want to input information, such like userLogin.nav or modifyAddress.nav, i have to write a controller for each one of these functions. i am using simpleformcontroller to handle these requests.

    i knew it is a very very bad design, but can not find a better way to implement spring. Any good thoughts?
    Last edited by victorysoccer; Nov 2nd, 2009, 03:03 AM.

  • #2
    You will have a much easier time if you use annotation-based controllers, which are far more configurable and friendly to changes.

    You will then have the ability to process multiple URLs with one controller, and you can organize your controllers however you want.

    I have a short example of annotation-based Spring MVC here.

    You might also want to consult the relevant section of the Spring Reference, which is here.


    • #3
      Thanks for your reply,
      though the latest spring 3 version is going to deprecate the xml controller to move to annotation configured controller, i don't see the requirement to move my project to such systems.

      anyways, thank for bring me to this jdk1.5 system.