Pivotal Knowledge Base

Follow

VMware: What is the proper way to pass variables between gsp pages in Grails?

[Preliminary] What is the proper way to pass variables between gsp pages in Grails? (2016808_draft)

Resolution


By default the g:set tag uses the 'page' scope which would not make the variable available beyond the current page. However, either the 'session' scope, which lasts for the entire user session, or 'flash' scope can be used if something shorter lived is sought:
 
page1.gsp: 
< g:set var="fromIndex" value="IndexValue" scope="session" >
 
page2.gsp: 
add: ${session.fromIndex}
©VMware 2013

Comments

Powered by Zendesk