19 Mar
2009
19 Mar
'09
9:16 a.m.
Hi, I'm trying to access session from a Groovy class, but I'm not successful. When I have a simple script: <% session = request.getSession(true); counter = session.getValue("counter") %> - everything is OK. But when I have a class: class User { def counter = 0; void setUser() { session = request.getSession(true); counter = session.getValue("counter") } String showCounter() { return this.counter; } } The Error message is No such property: request for class: User. So how should I access session from the class? Thanks, Zik