深入浅出 jsp and servlet 第二版 读书笔记

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.

猜你喜欢

转载自crazyseabiscuit.iteye.com/blog/576674