在我的grails项目中,我使用的是spring security core插件.我提供了注销链接
<g:link controller="logout">Logout</g:link> in my gsp pages.
Run Code Online (Sandbox Code Playgroud)
LogoutController中的代码为:
class LogoutController {
/**
* Index action. Redirects to the Spring security logout uri.
*/
def index = {
// TODO put any pre-logout code here
session.invalidate()
redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl // '/j_spring_security_logout'
}
}
Run Code Online (Sandbox Code Playgroud)
当用户单击它时,它会将用户重定向到登录页面.但是,如果用户单击浏览器的后退按钮,则用户可以看到上一个工作页面.我不想将他重定向到上一页,他应该留在登录页面上.我能做些什么?
附加信息:我创建了一个标记库,用于检查登录用户的用户名.如果是匿名的,它会重定向到登录页面或将其发送到主页.但是使用它,用户必须点击某些东西.因为当前注销后,用户可以通过单击后退按钮查看上一页.我不想在前一页重定向他.他应该留在登录页面上.
大家好,我是grails的新手.我通过命令对象将字段值从gsp传递给控制器.在我的gsp页面上有一个叫做手机号码的字段.但是当我要通过命令对象访问它时,它会给我一个错误,因为它不会将类似98xxxxxxxx的值从字符串转换为整数.在我的命令对象中,我已经提到它为整数
Integer mobile;
Run Code Online (Sandbox Code Playgroud)
我在gsp上的代码是:
<label for="mobile">Mobile</label>
<input type="text" value="${cmd?.mobile}" title="" name="mobile" id="mobile" size="30" maxlength="10"/>
Run Code Online (Sandbox Code Playgroud)
其中cmd是我的命令对象.
和控制器中的代码:
def addInstitute={InstituteCommand cmd->
Address address=new Address();
address.mobile=cmd.mobile;
}
Run Code Online (Sandbox Code Playgroud)
它给了我typeMismatch错误.当我输入像1111111111这样的值时,它会保存它,但是当我输入实际的移动号码时.它给了我typeMismatch错误.这个场景怎么办?