package hompage
import logindetails.*
import login.User
import grails.plugins.springsecurity.Secured;
class RedirectController
{
def springSecurityService
def index() { }
/**
* This method will redirect the user if it has the role "ROLE_ADMIN"
*/
@Secured(['ROLE_ADMIN'])
def adminhomepage =
{
render(view: "adminhome")
}
/**
* This method will redirect the user if it has the role "ROLE_USER"
*/
@Secured(['ROLE_USER'])
def userhomepage=
{
render(view: "userhome")
}
}
这是我的代码,当且仅当角色是 ROLE_ADMIN 时我想重定向到 adminhome,如果角色是 ROLE_USER,我想重定向到 userhome。
请帮助我执行此代码。
我正在使用 netbeans IDE,并且有 import import grails.plugins.springsecurity.Secured的警告(如通常显示 java 代码的红色感叹号)
unable to resolve class grails.plugins.springsecurity.Secured @ line 5, column 1.
即使存在导入,我也没有得到它有什么问题?