Java Web Entry-level development Common page debugging method

Source: Internet
Author: User
Tags chrome developer chrome developer tools java web

This article introduces the code-tuning method commonly used in the Java Web entry-level development; (Only for entry-level child boots Reference);

Tools: Chrome Browser (the higher the version the better);

Java Web Entry-level development is mainly two aspects: Java operation Database JDBC; and Java output page: JSP;

So the idea of this article is to follow this way: First of all: to determine whether the problem appears in the back end or in the front; Second: How to use the debug mode to develop the backend; Again: Front end how to use debug mode development.

1: Define what part of the problem appears?

Here you can use the chrome developer tools to help analyze:

Open Developer Tools: View NetWork: From here it is easy to find the request sent by the backend and return content; With the URL path can find the specific method of the request, with the return of the content can know that the results are not what you want;

So is the elimination of the law, the back end of the wood problem, that is in the front.

2: Back end How to use Debug mode:

The first thing to do is to turn on Debug mode:

Second: Hit the breakpoint: Then press F6 can be viewed row by line; F8 is skipping the current breakpoint;

The magic of Debug is 1: You can see the value of the current variable; 2: You can modify the Java code directly, and immediately take effect; It's really great!

(Of course, if you write a new method, he may have an error, the newspaper did not find such a method, how to do it: Java reflection);

Back-end parts are relatively ripe, the following is mainly about the front-end debugging;

3: Front-end debug mode debug:

or developer tools:

Sources this is the source code; Can view jsp:js files, etc.;

Add breakpoints Manually: Enter the debugger manually where you want to set the breakpoint; Chrome browser Support directly modify the JS file directly into effect, do not need to refresh the page;

JSP is essentially a. java file, so JS supports direct modification; JSP does not support direct modification; Therefore: This is also the JS and JSP belong to different files of the benefits;

Console: This is the console: You can print out some information; This common not to do too much introduction:

Elements: This is the element: through the mouse pointer is very convenient to find the corresponding source code on the page;  For example I want to know what method to invoke when clicking the current button; It can be quickly viewed in this way directly;

By placing the mouse over the specified button, you will see that the corresponding HTML content can be found with its ID attribute and events.

The above is the Java Web entry-level development of common debugging methods;

Java Web Entry-level development Common page debugging method

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.