无状态Spring MVC [英] Stateless Spring MVC

查看:98
本文介绍了无状态Spring MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在阅读《 Spring in Action 3rd Edition》,并一直在尝试使用Spring MVC. 一切正常,直到我尝试将示例Web应用程序移植"到无状态Web应用程序.

Im currently reading Spring in Action 3rd edition, and have been experimenting with Spring MVC. Everything works well, until i tried to 'port' my example webapp to a stateless webapp.

要确定是否创建了会话对象,我在/* URL映射上放置了一个调试servlet过滤器,该过滤器仅打印出req.getSession(false),并继续执行链.

To determine whether a session object is created, i placed a debugging servlet filter on /* URL mapping, which just print out the req.getSession(false), and continue the chain.

我尝试更改所有控制器的作用域以请求幼稚,但是当然,会话仍在将模型绑定到表单的页面/控制器上创建. 我不知道如何实现无状态Spring MVC?到目前为止,我还不了解有关此问题的教程.

I tried changing all of my controllers' scope to request out naiveness, but of course, session is still created on a page/controller that binds the model to the form. I wonder how to achieve stateless Spring MVC ? Im out of luck for tutorials on this matter so far.

推荐答案

确保所有JSP都使用

<%@page session="false" %>

否则,将在执行JSP后立即创建会话.

else a session will be created as soon as a JSP is executed.

这篇关于无状态Spring MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆