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

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -