如何使用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 儿童毕业祝福语 简短6
14 开工仪式横幅祝福语简短
15 孩子日常祝福语大全简短
16 清晨寄语诗句祝福语简短
17 结婚送亲认亲祝福语简短
18 虎年喝酒拜年祝福语简短