gpt4 book ai didi

java - 使用 Grails 注销后重定向到 home/index

转载 作者:行者123 更新时间:2023-12-02 05:04:07 25 4
gpt4 key购买 nike

我正在尝试注销并重定向到我的 grails 应用程序中的登录页面。我目前重定向到“注销”页面,显示用户已注销。我的登录页面位于登录文件夹内。

注销到我的login/index.gsp后如何重定向?

我尝试了以下方法,但没有成功

render view: "/login/index.gsp"
render view: "login/index.gsp"
render view: "/login"
render view: "login"

这是我的 Controller :

import org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils

class LogoutController {

def logoutHandlers

def index = {
redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl // '/j_spring_security_logout'
}

def page = {
render view: "index.gsp"
}
}

最佳答案

这应该有效

render view: "/login/index"

请注意,您永远不应该在 View 名称中包含 .gsp,因此您还需要更改它

def page = {
render view: "index.gsp"
}

关于java - 使用 Grails 注销后重定向到 home/index,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27951087/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com