Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grails 3.0.9: flash does not work when using interceptor and "g:include" tag #9370

Closed
daniellansun opened this issue Oct 24, 2015 · 2 comments
Assignees
Milestone

Comments

@daniellansun
Copy link

flash does not work when using interceptor and "g:include" tag, the messagInterceptor in the gsp will be missing when using "g:include" tag. the following code can reproduce the issue(pls access: http://localhost:8080/test/edit)

controllers/test309/TestController.groovy

package test309
class TestController {
    def index() {
    flash.messageController = 'Hello, Controller!'
    render view:'index'
    }
    def edit() {}
}

controllers/test309/TestInterceptor.groovy

package test309
class TestInterceptor {
    public TestInterceptor() {
    match(controller:'test', action:'edit')
    }
    boolean before() { 
        flash.messageInterceptor = 'Hello, Interceptor!'
    redirect controller:'test', action:'index'
    return false;
    }
    boolean after() { true }
    void afterView() { }
}

views/test/index.gsp

<g:include view="test/toInclude.gsp"/><!-- Including the view will make 'flash.messageInterceptor' set in the TestInterceptor missing -->
<!doctype html>
<html>
    <head>
    <meta name="layout" content="main"/>
    </head>
    <body>
       <span style="color:${fontColor}"> 
    messageController:${flash.messageController}
    <br />
    messageInterceptor:${flash.messageInterceptor} <!-- messageInterceptor does not display -->
    </span>
    </body>
</html>

views/test/toInclude.gsp

<g:set var="fontColor" value="${'#68AC61'}" scope="request"/>
@daniellansun
Copy link
Author

3

@graemerocher
Copy link
Member

@jeffbrown I think this is the same as #9799 only we would need to add WebUtils.isInclude to the change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants