gsp - using <set> tag in grails -


i new grails. came across set tag can use in gsp pages set values similar setting model controller.

<g:set var="home" value="something" /> 

so when write ${home} outputs "something".

is there way set value in sessions in gsp pages , not controller using set tag?

yes can in gsp pages well. have include attribute scope indicate scopes(session, flash, page , request) setting value to.

<g:set var="home" value="something" scope="session" /> 

if donot include scope option defaults request scope.

to display the value have write ${session.home} or ${request.home} or ${home} request scope. hope helps.

for more : https://grails.github.io/grails-doc/3.0.x/ref/tags/set.html


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -