import controllers from ROOT controller folder

View: New views
2 Messages — Rating Filter:   Alert me  

import controllers from ROOT controller folder

by tonylim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a controller in

--------------------------------------------------------------
grails-app/controller/com/SampleController.groovy
--------------------------------------------------------------

and I need to access the controller

--------------------------------------------------------------
grails-app/controller/ShiroUserController.groovy
--------------------------------------------------------------

how do I import ShiroUser to be used by Sample Controller?  I need to access a Controller that is one folder back.  I keep getting the error.

-------------------------------
Exception Message: No such property: ShiroUser for class: com.SampleController
-------------------------------

From ShiroUser i just add "import com.*" and it works.  How do I do it from Sample?

Thanks!

Re: import controllers from ROOT controller folder

by Daniel Latorre :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

The root controller/domain/services... folder is the default package, and is a grails bad practice as when we are developing with java, you can't use a class in the default package by a class on another package. You should move ShiroUser to a package.

Cheers

2009/11/4 tonylim <tonylim@...>

I have a controller in

--------------------------------------------------------------
grails-app/controller/com/SampleController.groovy
--------------------------------------------------------------

and I need to access the controller

--------------------------------------------------------------
grails-app/controller/ShiroUserController.groovy
--------------------------------------------------------------

how do I import ShiroUser to be used by Sample Controller?  I need to access
a Controller that is one folder back.  I keep getting the error.

-------------------------------
Exception Message: No such property: ShiroUser for class:
com.SampleController
-------------------------------

From ShiroUser i just add "import com.*" and it works.  How do I do it from
Sample?

Thanks!
--
View this message in context: http://old.nabble.com/import-controllers-from-ROOT-controller-folder-tp26169187p26169187.html
Sent from the grails - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Daniel Latorre
Co-founder: http://www.jobsket.com/
My CV: http://www.jobsket.es/cv/dani
My website: http://www.danilat.com/