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.