Grails session cannot assign java.string
I'm getting this error
Error 500: Executing action [pay] of controller [org.gamestrike.PaymentController] caused exception: groovy.lang.MissingMethodException: No signature of method开发者_JAVA技巧: org.gamestrike.PaymentController.session() is applicable for argument types: (java.lang.String) values: [2011-09-15] Possible solutions: getSession() Servlet: grails URI: /GameStrike/grails/payment/pay.dispatch Exception Message: No signature of method: org.gamestrike.PaymentController.session() is applicable for argument types: (java.lang.String) values: [2011-09-15] Possible solutions: getSession() Caused by: No signature of method: org.gamestrike.PaymentController.session() is applicable for argument types: (java.lang.String) values: [2011-09-15] Possible solutions: getSession() Class: PaymentController At Line: [35] Code Snippet:
Without your code it's hard to tell, but it looks like you're treating session
like a method, but it's not. It's an object - the HttpSession
instance.
You can call the standard methods on it, e.g. getAttribute
and setAttribute
but Grails adds convenience behavior. It acts like a Map
so to set or get attributes you can do this:
def foo = session.foo // session.getAttribute('foo')
session.bar = 123 // session..setAttribute('bar', 123)
精彩评论