Common page debugging methods for java web entry-level development, javaweb

Source: Internet
Author: User

Common page debugging methods for java web entry-level development, javaweb

Here we will introduce the common code adjustment methods in Java web entry-level development (for reference only );

Tool: chrome (the higher the version, the better );

Java web entry-level development mainly involves two aspects: Java JDBC for database operations; and Java output page: JSP;

Therefore, the idea of this article is to follow these steps: first, judge whether the problem occurs at the backend or at the front end; second, how to use the debug mode for backend development; and again: how to Use the debug mode for front-end development.

1: define where the problem occurs?

Here, we use chrome's developer tools to help analyze:

Open the developer tool: view the netWork: it is easy to find the request and returned content that you want to send at the backend. With the URL path, you can find the specific request method, with the returned content, you can know whether the returned result is desired;

So it is the exclusion method. If the back-end wood problem occurs, it is at the front-end.

 

 

2: How to Use the debug mode on the backend:

First, you must enable the debug mode:

Second, place the breakpoint: Press F6 to view it row by row; F8 is to skip the current breakpoint;

The magic of debug is that 1: You can view the value of the current variable; 2: You can directly modify the Java code and immediately take effect; this is really great!

(Of course, if you write a new method, he may report an error and fail to find the method. How can this be done: Java reflection );

The backend part is relatively familiar. The following describes the front-end debugging;

3: debug the frontend debug mode:

Or developer tools:

Sources: source code. You can view jsp: js files;

 

Manually add a breakpoint:Manually enter the debugger where you want to set the breakpoint; chrome supports direct modification of js files to take effect without refreshing the page again;

Jsp is actually a. java file, so js supports direct modification; jsp does not support direct modification; so: this is also the benefit of separating js and jsp into different files;

Console: This is the console: You can print out some information. This is usually not described too much:

Elements: this is an element: you can easily find the corresponding source code on the page through the mouse pointer. For example, if you want to know what method will be called by clicking the current button, you can quickly view it in this way;

Place the cursor at the specified button and you will see the corresponding html content. You can find its id attribute and event;

 

The above are common debugging methods for Java web entry-level development;

 

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.