Сервлет вызывающего абонента:
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<HTML>");
out.println("<BODY>Will you see the source?");
out.println("</BODY></HTML>");
RequestDispatcher disp=req.getRequestDispatcher("/Test");
disp.forward(req, res);
out.close();
}
("/Test"):
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<HTML><TITLE>The Test</TITLE>");
out.println("<BODY>Will you see the target?");
out.println("</BODY></HTML>");
out.close();
}
Почему это выдает только «Вы увидите цель?»?Разве это не должно печатать "Вы увидите источник?"тоже, так как PrintWriter находится перед форвардом?