Response.setheader ("Expires", String.valueof (System.currenttimemillis () + $ * 3600= "AAAAA"; Response.getwriter (). write (datastring);
If the code above, plus the expires time, is equivalent to caching the resource.
// implement the Request redirection method one response.setstatus (302); Response.setheader ("Location", "/day06"); // implement the Request redirection method two response.sendredirect ("/day06");
Both of these methods are sent requests redirected to the/DAY06 page. The server will receive two requests and the browser address bar will change.
Each time the browser refreshes, the last action is resubmitted, and redirection avoids the problem.
http Status 500- Getoutputstream () have already been called for this response type Exception reportmessage getoutputstream () have Alrea Dy been called for this responsedescription the server encountered a internal error that prevented it from fulfilling thi S Request.exceptionjava.lang.IllegalStateException:getOutputStream () have already been called for this response Org.apa Che.catalina.connector.Response.getWriter (response.java:662) Org.apache.catalina.connector.ResponseFacade.getWriter (responsefacade.java:213) Cn.itcast.response.ResponseDemo8.doGet (responsedemo8.java:27) Javax.servlet.http.HttpServlet.service ( httpservlet.java:624) Javax.servlet.http.HttpServlet.service (httpservlet.java:731) Org.apache.tomcat.websocket.server.WsFilter.doFilter (wsfilter.java:52) Note the full stack trace of the root cause is Available in the Apache tomcat/7.0.77 logs.
This is a common exception because Response.getoutputstream () is used in the code snippet at the same time; and Response.getwriter ();
[Java] [Web] Response Learning. Caching