Eclipse Debug Web Project __web

Source: Internet
Author: User
Tags tomcat server

Http://www.cnblogs.com/qrlozte/p/3532522.html

*************************************

I've never known how to debug a Web project in eclipse, such as if I break a point in a servlet or action, and then how do I debug it?

Today, we stumbled upon what was possible, as follows:

1.

Configure your server, such as Tomcat, see http://www.cnblogs.com/qrlozte/p/3175170.html

2.

Select Run>debug configurations, select the Tomcat Server you configured on the left, select the source tag on the right, and configure your code source file (otherwise you will be prompted to find the source code location when you debug it. Of course, you can also wait for Eclipse hint to configure later, the location is similar to E:/MYPROJECTS/WEBPROJECT_ONE/SRC, all your package and Java files are in this directory, select Add, find the code directory, You can add it in.

Then click Apply to close the Debug Configurations window

3.

Make sure Tomcat is off.

4.

Select Run>debug as>debug on Server

And then you do it on the web, and the code runs to where you're interrupting. Eclipse will naturally prompt you, which is no different than debugging a normal Java program.

Skills:

1. Directly right-click the server in eclipse (make sure the server is turned off), select "Debug" to start the server, and then, when you want to debug, hit BP in the code (breakpoint, next), if you don't want to debug, Just delete the BP normal operation, do not need to constantly restart the server.

For example, when you find that a page of yours is submitting a form, the first submission, no problem, the same page 2 times to submit the same data, the second commit will be wrong (the results of the program running is not what you want, but you do not know what the wrong is), you want to see how the second submission differs from the first submission What to do. Okay, then do it:

1. In eclipse, start the server in debug mode

2, for example, you are wrong page is login.jsp, the data is submitted to Loginservlet, not hit BP, submit a data (we will submit the data collectively as: Data a), and then return to login.jsp

3, the above has said, if we submit the same data, will lead to errors, so now we give Loginservlet a breakpoint, in login.jsp to submit "data a", then you can debug in Loginservlet, observe, find the bug , solve the problem

2. If you are in debug, hit BP, the program ran you hit the BP method, but did not continue to carry on, but appears "suspend", how to do.

Answer: click: Run>resume can


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.