开发者

Grails. Ways to set the timeout interval of a session. Which better?

I know two ways to set the timeout interval of a session:

way 1:

grails install-templates

Then edit src/templates/war/web.xml

way 2:

write this line of code in your contr开发者_StackOverflow社区oller:

session.setMaxInactiveInterval(sec);

Which of these ways do you think is better - and why?


Changing the value in web.xml is best if you want a constant value for all sessions.

setMaxInactiveInterval is useful when you want to programmatically determine the current session's max length, but it's overkill to just set the value repeatedly to the same value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜