Developing servlets with Eclipse, using System.out.println () to print out data in the console

Source: Internet
Author: User

Many times when we find that the servlet we wrote has a problem, we will subconsciously insert System.out.println () in the relevant place to print out the currently obtained data, but when developing the servlet, you will find , The print statement you just wrote does not print after executing the project, you will think about it, most novices do not know where the real problem is, go to Baidu on the Internet and find a lot of things, like what The java file is not compiled into a class, and there is a problem with the placement of the servlet, but you will find that you do not need to deploy these at all if you are developing under eclipse, and then you will wonder if there is a problem with your own myeclipse, or My eclispe web plug-in configuration is wrong. In short, the more I look at it, the more I think this matter is serious. However, all this is considered to be insufficient experience for our beginners!
    Actually, the essential problem is not like this, eclispe does automatically compile for us, but this is a switch and you need to set it yourself. This means that it is not that your servlet cannot print because of a problem, but because the servlet on your server has not been updated to the latest version of you, and the previous version did not print the statement, so of course it will not print. This problem is actually very simple, you just need to click on project-> Build Automatically here, and then add a "check mark" in the front to compile automatically. In fact, in this case, your problem has been solved, and interested people will I will ask, then why did I not set the automatic compilation every time I made a change in jsp, why does he still show the latest change results?
    This is because the j2ee program is deployed in the application server. The jsp file must first be converted into a servlet file. The servlet file is actually a java file. It is compiled into a .class file. When the server finds that the jsp page is modified, it will reparse the jsp file. So it is up to date. The servlet has been compiled into a class file. If you modify the servlet file, the application server will not retrieve and recompile it. You need to recompile the modified java file and replace the previous class file.


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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.