0
我知道两种方法来设置会话超时时间:Grails。如何设置会话的超时间隔。哪个更好?
方式1:
grails install-templates
然后编辑src/templates/war/web.xml
方式2:
写这行代码在你控制器:
session.setMaxInactiveInterval(sec);
你认为哪种方式更好 - 为什么?
我知道两种方法来设置会话超时时间:Grails。如何设置会话的超时间隔。哪个更好?
方式1:
grails install-templates
然后编辑src/templates/war/web.xml
方式2:
写这行代码在你控制器:
session.setMaxInactiveInterval(sec);
你认为哪种方式更好 - 为什么?
如果您希望所有会话的值保持不变,那么更改web.xml中的值是最好的选择。
setMaxInactiveInterval
当您希望以编程方式确定当前会话的最大长度时非常有用,但将它重复设置为相同的值是过度的。
在web.xml中设置`session-timeout`时,它是否有最大允许值? – raffian 2014-02-20 17:00:59