如何使用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 舞台上祝福语大全简短