请让我帮忙了解何时使用会话而不是RequestDispatcher。 到目前为止,我已经看到我可以将数据从servlet传递到servlet和jsp转发请求,它几乎可以区分两种不同的请求。那么何时以及为什么我应该使用Session?请帮助我理解这一点。HttpSession vs RequestDispatcher
0
A
回答
1
HTTP是请求/响应模式之后的无状态协议。这意味着你从客户端获得请求并发回响应。客户端和服务器之间没有会话状态。因此,如果您需要保持对话状态(例如:购物卡,向导等) - 您需要识别您的客户端(了解哪个请求来自哪个客户端)。这是会话用来做什么的。
+0
非常感谢。你已经给出了一个明确令人满意的答案,这一切都很清楚。 –
+0
非常欢迎您! – fg78nc
相关问题
- 1. HttpSession空BlobstoreService
- 2. RequestDispatcher
- 3. 会话范围的托管bean vs有状态的bean vs httpsession
- 4. RequestDispatcher的HTML体
- 5. JSF/Icefaces RequestDispatcher
- 6. 添加RequestDispatcher的
- 7. Spring MVC | requestDispatcher&sendRedirect
- 8. Grails httpsession
- 9. RequestDispatcher的在Java中
- 10. Servlet RequestDispatcher #include和pathInfo
- 11. 重用RequestDispatcher对象
- 12. HttpSession存储URL
- 13. HttpSession不工作?
- 14. HttpSession超时
- 15. 的Java HttpSession中
- 16. HttpSession Java EE
- 17. HttpSession安全
- 18. HttpSession,session.getAttribute(),问题
- 19. 远程服务器的RequestDispatcher?
- 20. RequestDispatcher的使用Struts2的
- 21. 发生`RequestDispatcher`时的NullPointerException
- 22. 从servlet重定向jsp RequestDispatcher
- 23. HttpSession不起作用
- 24. HTTPSession变量限制
- 25. 没有Cookie的HttpSession
- 26. REST和HttpSession对象
- 27. 春天注入httpSession ApplicationListener
- 28. window.location.reload(true)会清除HttpSession?
- 29. DisplayTag有关HttpSession的问题
- 30. HttpSession与EJb的结合
我想你的问题应该是sendRedirect vs RequestDispatcher –
不,我的问题是特别的那一个。 –