Announcement Announcement Module
No announcement yet.
Group Controllers and Views into Modules Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Group Controllers and Views into Modules

    I'm writing some shop system and I've got problem.
    I'd like to group my controllers and views into few logical modules, my directories structure looks as below:

    /WEB-INF/admin - views for administrator controllers
    /WEB-INF/ws - views for webservices
    /WEB-INF/web - vews for normal website

    com.darek.coffeine.admin - controllers for administrator - controllers for webservices
    com.darek.coffeine.web - controllers for normal website

    Id like to map url calls to this groups, for example
    htp:// will execute IndexController in com.darek.coffeine.admin, but htp:// will execute IndexController from com.darek.coffeine.web.

    What's the best solution for this problem. I've tried to make few HandlerMappings in my coffeine-servlet.xml but there are Controllers that had this same name (diffrent package), and i don't know how to bind them to addresses.

  • #2
    If you are using annotations then you need to do something like @RequestMapping("/admin/index.htm")

    if you are using BeanNameUrlHandlerMapping, then the name of your bean should be

    <bean name="/admin/index.htm" class ="bla.bla.bla.admin.IndexController"/> or something like that.
    You will also need to get sure that all your images, css and javascripts are reached correctly, c:url could help you


    • #3
      I'll try it when I come back to home.
      But what's better. Use Annotations or Traditional Mappings? I saw that in SpringFramework 3 there will be much more Annotations.


      • #4
        I prefer annotations because is less verbose, and actualy i remember reading somewhere that in spring 3 they will deprecated all the non annotation web controllers but im not sure of that.