Электронный магазин на Java и XML



         

Код для сервлета TheNewsServ - часть 3


// assumes response has been set to text/html private void errorMsg( PrintWriter out, String msg, Exception ex ){ header( out ); out.println("<h2>Error: " ); out.println( msg ); out.println("</h2><br>"); if( ex != null ){ ex.printStackTrace( out ); } out.println("<br>"); out.println("<a href=\"mailto:wbrogden@bga.com\">Please mail me the error message.</a><br>"); footer( out ); }

private void header(PrintWriter out ){ out.println("<html>"); out.println("<head><title>Company News Servlet</title> </head>"); out.println("<body>"); }

private void footer(PrintWriter out ){ out.println("<hr><br>Company News Servlet " + version + " properties: <br>" ); out.println("</body>"); out.println("</html>"); out.close(); }

}




Содержание  Назад  Вперед