1st. redirect= client = 客户端跳转
request = server = 服务器端跳转
A request redirect is different from a request dispatch. A request dispatch
(covered more in another chapter) happens on the server, while a redirect
happens on the client. A request dispatch hands the request to another
component on the server, usually within the same web app. A request
redirect simply tells the browser to go a different URL
2nd. HttpServletResponse 常用方法 setContentType, getWriter
3rd. To redirect a request, call sendRedirect(aStringURL) on the response.
4th. You cannot call sendRedirect() after the response is committed! In other
words, if you’ve already written something to the stream, it’s too late to do
a redirect.
request = server = 服务器端跳转
A request redirect is different from a request dispatch. A request dispatch
(covered more in another chapter) happens on the server, while a redirect
happens on the client. A request dispatch hands the request to another
component on the server, usually within the same web app. A request
redirect simply tells the browser to go a different URL
2nd. HttpServletResponse 常用方法 setContentType, getWriter
3rd. To redirect a request, call sendRedirect(aStringURL) on the response.
4th. You cannot call sendRedirect() after the response is committed! In other
words, if you’ve already written something to the stream, it’s too late to do
a redirect.
本文探讨了HTTP请求重定向与请求调度的区别及应用。详细解释了客户端重定向与服务器端调度的工作原理,并介绍了HttpServletResponse类中setContentType与getWriter等方法的使用。此外,还强调了sendRedirect方法的正确调用时机及其限制。
4435

被折叠的 条评论
为什么被折叠?



