实际上根据sun的规范(servlet 2.3),只要求一个jvm或一个virtual host有自己不同的servlet context。同时规范中又说,HttpSession objects(web container 实现HttpSession接口的对象)must be scoped at the application (or servlet context)。 所以应该是可以直接共享Session。个人认为你的方案很好,我们不能依赖规范,也许不同的web container实现的结果不一样。如果你要自己处理session,要注意考虑实现两种跟踪机制:cookie和URL回写