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

  • Group Controllers and Views into Modules

    Hi,
    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
    com.darek.coffeine.ws - controllers for webservices
    com.darek.coffeine.web - controllers for normal website


    Id like to map url calls to this groups, for example
    htp://example.com/admin/index.html will execute IndexController in com.darek.coffeine.admin, but htp://example.com/index.html 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

    Comment


    • #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.

      Comment


      • #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.

        Comment

        Working...
        X