|
I´ve created a directory called adm inside controllers. My class LoginController.groovy (in adm), get an error :
Error Details Message: No such property: Usuario for class: adm.LoginController Caused by: groovy.lang.MissingPropertyException: No such property: User for class: adm.LoginController Class: LoginController At Line: [15] _______________________: Stack Trace org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingPropertyException: No such property: User for class: adm.LoginController at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:92) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912) ..... --------------------------------------- my class LoginController.groovy : package adm class LoginController { CryptoService cryptoService MailService mailService def index = { render(view:'login') } def login = { if (params.userid && params.password) { def user = User.findByUser("test") String calcPassword = cryptoService.sha1(params.password.getBytes()) if (user != null && user.password == calcPassword) { ...... Herrera |
|
Looks like your User class is not in the adm package. If your controller is in a package, it will not be able to access classes in the default package.
To fix, either move the domain classes to a a package (maybe "adm.model") or move the controller back into the default controllers directory. HTH - Richard
|
If you move your User domain class into a package, don't forget to import it in the controller class. If your intention is to provide separate url path for administration purposes (e.g. /myapp/adm/), you can also use URL Mappings like this:
(see section 6.4. of the Grails documentation: http://grails.org/doc/1.0.x/guide/6.%20The%20Web%20Layer.html#6.4%20URL%20Mappings) |
|
In reply to this post by Herrera
Since your controller is in different package, you need to import the
User class. Note also that this User class cannot be in the default package. On Tue, Aug 26, 2008 at 4:54 PM, Pedro Herrera <[hidden email]> wrote: > > I´ve created a directory called adm inside controllers. My class > LoginController.groovy (in adm), get an error : > > Error Details > Message: No such property: Usuario for class: adm.LoginController > Caused by: groovy.lang.MissingPropertyException: No such property: User for > class: adm.LoginController > Class: LoginController > At Line: [15] > _______________________: > > Stack Trace > > org.codehaus.groovy.runtime.InvokerInvocationException: > groovy.lang.MissingPropertyException: No such property: User for class: > adm.LoginController > > at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:92) > > at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230) > > at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912) > > ..... > > --------------------------------------- > my class LoginController.groovy : > > package adm > > > > class LoginController { > > > CryptoService cryptoService > MailService mailService > > > > def index = { render(view:'login') } > > def login = { > if (params.userid && params.password) { > > > def user = User.findByUser("test") > > String calcPassword = cryptoService.sha1(params.password.getBytes()) > if (user != null && user.password == calcPassword) { > > ...... > > > Herrera > > > > > > > > -- > View this message in context: http://www.nabble.com/Controller-in-a-different-diretory-tp19163657p19163657.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 > > > |
|
In reply to this post by Herrera
On Tue, Aug 26, 2008 at 8:54 AM, Pedro Herrera
<[hidden email]> wrote: > > I´ve created a directory called adm inside controllers. My class > LoginController.groovy (in adm), get an error : > > Error Details > Message: No such property: Usuario for class: adm.LoginController > Caused by: groovy.lang.MissingPropertyException: No such property: User for > class: adm.LoginController > Class: LoginController > At Line: [15] > _______________________: > > Stack Trace > > org.codehaus.groovy.runtime.InvokerInvocationException: > groovy.lang.MissingPropertyException: No such property: User for class: > adm.LoginController Is User in the adm package? If not, it needs to be imported. That's usually the issue when I see this error. HTH, Jon --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Powered by Nabble | Edit this page |
