views:

263

answers:

2

Im developing a Grails App. I have about 20 Controllers right now and there will be more. Is there a way to Group the Controllers in functional Packages? I would like to have something like:

grails-app/administration/<controller classes>
grails-app/usercontent/<controller classes>
grails-app/publiccontent/<controller classes>

The best would be if the Package would not appear in the URL.

Regards Falko

+4  A: 

You can do something similar by putting your controllers into Java/Groovy packages:

package administration
class UserController { ... }

and placing the source code into corresponding sub-directories of grails-app/controllers/, eg. grails-app/controllers/administration/UserController.groovy. This won't change the default URL Mapping (ie. the package name is not included in the URL). Note however, that your controller names have to be unique even across different packages!

I'm not aware of any easy approach to achieve the directory layout you suggested (no controller/ in the path).

Daniel Rinser
thas exactly what i was looking for .. leaving out the controller in directory structure was my problem.
HaBaLeS
A: 

How would you refer to the domains ? I am having trouble creating a new domain when I add the controller in folder (package)

Moe