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 - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -