JSP server response, OUT.PRINTLN and Response.setintheader error resolution, attached: How to import a jar package

Source: Internet
Author: User

Tags: response jar package Print error Let get write Time share

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: