重定向出错

严重: Servlet.service() for servlet [jsp] in context with path [/imooc_jspstudy] threw exception [An exception occurred processing JSP page /response.jsp at line 19


pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Insert title here</title>

</head>

<body>

<h1>response内置对象</h1>

<hr>

<%=request.getContextPath() %>

<%

out.print("<p>你好!</p>");

out.flush();

PrintWriter outer = response.getWriter();

outer.print("这是response的输出流用法");

response.sendRedirect("request.jsp");

%>


</body>

</html>



Stacktrace:] with root cause

java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed


慕妹8769748
浏览 1508回答 3
3回答

慕妹8769748

重定向和转发的页面不可以有HTML标签的输出

慕妹8769748

大神能具体点么 谢谢了

echo_kinchao

定向错了
打开App,查看更多内容
随时随地看视频慕课网APP