我正在尝试发回一些用HTML编码的HTTP。我得到“方法sendStatus(int,String)未定义类型HttpServletResponse”错误。我也只尝试过代码。如果我改为使用sendError(),则不会发送HTML。
<%@page contentType="text/html; charset=utf-8" %>
<%@ page isErrorPage = "true"%>
<%response.sendStatus(500, "TEST 500 ERROR WITH HTML PAGE");%>
<html>
<body>
<h1>
Test HTTP Error: 500 ERROR with HTML page
</h1>
</body>
</html>
我得到了:
ERROR_500_subjectdoc_htmlheader_error_realhtmlerrorpage.jsp:3:12: The method sendStatus(int, String) is undefined for the type HttpServletResponse
<%response.sendStatus(500, "TEST 500 ERROR WITH HTML PAGE");%>