Java Reference
In-Depth Information
{
reply.setContentType("text/HTML");
PrintWriter out = reply.getWriter();
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>Result</TITLE>");
out.println("</HEAD>");
out.println("<BODY>");
out.println("<BR><BR><BR>");
out.println("<CENTER><H1><FONT COLOR='blue'>");
out.println("Result=" + result);
out.println("</FONT></H1></CENTER>");
out.println("</BODY>");
out.println("</HTML>");
out.fl ush();
}
}
Note the convenient dual-purpose use of method sendPage to return either the
result page or an error page (Figs. 8.5 , 8.6 and 8.7 ).
Fig. 8.5 Web page receiving two integers to be sent to a servlet
Search WWH ::




Custom Search