Is it possible to have 2 controllers with the same name and in different packages, grails 2.1.3

93 Views Asked by At

I want to create 2 controllers with the same name and in different packages, one for UI the other is REST.

Is this possible in grails 2.1.3? if yes, how?

ps: I tried and it didn't work, grails mix both controllers

1

There are 1 best solutions below

1
On

Defining and mapping controllers to URLs is done by convention. So if you have the same name XController in different packages, that would lead to the same mapping - and how would you decide which controller/action to call if both just have the same?

Rename one of your controller so it makes sense for the developer (e.G. UiXController) and then optionally do an url mapping if the URLs are important for some reason.