简体   繁体   English

Grails重定向,转发和渲染更改视图,并显示Grails标语/模板

[英]Grails redirect, forward and render alter view and shows Grails banner/template

When I redirect to another page, Grails alters the screen by adding a banner that looks like this: 当我重定向到另一个页面时,Grails通过添加如下所示的横幅来更改屏幕:

在此处输入图片说明

Here's a snippet of the code: 这是一段代码:

def login() {
    def user = userService.login(params.username, params.password)
    if(user){
        chain (action: "main", model: [user:user])
    }else{
        redirect (uri: "/")
    }
}

def main() {

}

I tried using forward and render instead of redirect, but the banner is still there. 我尝试使用转发和渲染而不是重定向,但是横幅仍然存在。

I am not sure if I understand you, but maybe you are rendering a gsp which has the meta layout included in the head block. 我不确定我是否理解您,但是也许您正在渲染的gsp包含在head块中的meta布局。

<meta name="layout" content="main">

Just delete it. 只需删除它。 If I am right you can find more info here: grails layouts 如果我是对的,您可以在此处找到更多信息: grails布局

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM