如何使用JSP向浏览器发送错误代码?
以下示例显示了如何将407错误代码发送到客户端浏览器。此后,浏览器将显示“需要身份验证!”消息。
<html>
<head>
<title>Setting HTTP Status Code</title>
</head>
<body>
<%
//设置错误代码和原因。
response.sendError(407, "Need authentication!!!" );
%>
</body>
</html>您将收到以下输出-
HTTP Status 407 - Need authentication!!!type Status reportmessageNeed authentication!!!descriptionThe client must first authenticate itself with the proxy (Need authentication!!!).Apache Tomcat/5.5.29
热门推荐
10 广西考试祝福语结婚简短
11 猪年祝福语简短小孩
12 元旦祝福语送长辈简短
13 恭喜二宝祝福语简短
14 祝福语暖心话简短
15 国庆中秋祝福语简短兄弟
16 朋友订婚的祝福语简短
17 送弟弟中秋祝福语简短
18 爱生日祝福语简短独特