In the nine built-in objects, I think the most used is out.println and response.setintheader, today just wrote a server response code, also always these two error. Please see the picture for details.
First of all, the Response.setintheader error, causing the main cause of the error, or did not import jar package, do not try other reasons, I have tried. The specific way to configure the jar package for Tomcat is as follows.
Locate the path in your computer, locate the Servlet-api.jar package in the Lib directory, and copy it to the desktop
Next, in the path of writing code, set up a Lib directory, drag the file into its directory,
Next, the error disappears.
、
Next, say response.setintheader problem, solve this problem is a bit simple and rude. A method in a Java IO stream is changed directly, both:
PrintWriter Printwriter=response.getwriter ();
Printwriter.print ("Current time:" + CT + "\ n");
This way, you can also give the desired result to the output.
JSP server response, OUT.PRINTLN and Response.setintheader error resolution, attached: How to import a jar package