cookie plugin grails - cookie is null -



cookie plugin grails - cookie is null -

with grails' cookie plugin, wich correctly installed, want set cookie:

response.setcookie("username", "cookiename", 1000)

this method "setcookie" underlined, in ide means not found, version doesnt work either

def cookieservice cookieservice.set(response, "username", "cookiename", 1000)

this line says, cookie null

println(cookieservice.get("username"))

what miss? wondering has grails running on server , performs task on client side (wich done js). can help? lot, daniel

dan: add together next code config.groovy

com.studentuniverse.grails.plugins.cookie.services.cookieservice.metaclass.setcookie = { response, name, value, maxage -> def cookie = new javax.servlet.http.cookie(name, value) cookie.setmaxage(maxage) cookie.setpath("/") response.addcookie(cookie) }

you getting null coz of path.. solve ur issue :)

grails cookies groovy

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -