forward 和include
1. Both are decorated on request, but also on the response include decorated. Mainly differ in on-time standard output stream.
2.forward: the current request is not over, need to continue, the server does not turn on the standard output stream in the servlet execution forward, the data here is not written in the client.
3.include: the current request has been completed, the client may respond to, not only writes its data output stream, can also contain other data to its output stream. The output stream is performed include opening the servlet.
one-servlet
request.setCharacterEncoding("utf-8");
String name = request.getParameter("name");
String age = request.getParameter("age");
response.setContentType("text/html;charset=utf-8");
response.getWriter().write(name+"<br/>");
request.getRequestDispatcher("other").include(request, response);
response.getWriter().write(age+"<br/>");
other-servlet
response.getWriter().write("data is forward");
console
流行
data is forward123