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

         

Методы errorMsg...



Листинг 8.18. Методы errorMsg, Header и Footer (TheNewsServ.java)

// 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();
} }



Содержание раздела