JavaScript web page entry-level development detailed explanation

JavaScript web page entry-level development detailed explanation

Part 3: ❤Three ways to overlook backend data reception❤ (recommended collection)

Part 2: Play with web form rapid web development (❤ Recommended collection ❤)

1. Introduction

Learn some knowledge about the web in advance, then let’s get to know this magical thing.

My idea is the Chinese version, but the difference is not big.

Step 1: First create a new project, follow the diagram

Step 2: Give it a name and then draw a picture

Step 3: This will pop up when you create a new project in the project, and it will pop up a new window.

Step 4: Click on the icon

Step 5: Make sure the circles are the same

Step 6: These two names are arbitrary

Step 7: Follow the instructions

Step 8: Just click Finish

Step 9: As shown in the picture

Step 10: Click the small triangle on the left of hello, then click the small triangle of src, and click all the small triangles you see in turn to find

The name of the module you just created. Here I created hello

Step 11: Right-click hello, move the mouse to the new one, and many packages will appear. Click the left button to complete the package.

Step 12: The words before hello are generated by ourselves. We just need to add a controller.

After building the package, we need to configure the environment. Idea itself does not support jsp, but in order to learn the principle

From simple jsp, we can learn some principles that we need later, so we need to use jsp,

So we need to learn a jsp language. idea itself does not support this language, so if we want to use jsp, we must import

rely.

Step 13: Right click in main as shown in the figure

Step 14: Enter webapp and press Enter

Step 15: Follow the steps shown in the figure below to complete the process

Step 16: Enter WEB-INF in this directory and press Enter

Step 17: Continue to right-click on the newly created WEB-INF and click the icon

Step 18: Enter views and press Enter

There is no jsp file we want under views, which means we have not imported dependencies yet. Before importing dependencies

We need to first determine where the root directory is

Step 19: To know where the root directory is, just click on the file as shown in the picture and click on the project structure

Step 20: As shown in the picture, you don’t have to panic, just click according to the sequence number I marked

After setting this as the root directory, we can put all the jsp files in it and call it.

Step 21: After completing the above step, there will be a jsp file under views, just click it, as shown in the figure

Step 22: Give it a random name, I named it a1, and press Enter

Step 23: The red circle is what I wrote casually, there is no requirement for the content, this will be displayed on the page later

Step 24: After completing the above step, double-click the red line and something on the right will appear. It doesn’t matter what it is.

Step 25: Import jsp dependencies. Just copy all the code snippets as shown in the figure.

 <!-- Add servlet dependency module-->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
        <!-- Add jstl tag library dependency module-->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>
        <!--Add tomcat dependency module.-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </dependency>
        <!-- Using jsp engine, springboot built-in tomcat does not have this dependency-->
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
</dependency>

Copy the above code to the position shown below, between these two words, usually on lines 18-19

Step 26: When you press ctrl+v to copy between these two words, two words will appear in the lower right corner. At this time, we only need to select the right

Draw a circle, automatic import is more convenient and faster

Step 27: After copying is complete, click Edit Configuration as shown in the icon.

Step 28: Click on the icon

Select the third one in the working directory, indicating that this folder is a module. It can also be seen that there is a module

English word.

Step 29: Click the small triangle on the left from src until you find conterller, then right-click, as shown in the figure.

Create a Demo class

Step 30: Enter @Con and press Enter to automatically complete the package name.

After completion, as shown in the figure:

This controller is equivalent to a controller. All programs must go through this controller at the beginning.

It is to process and accept data.

Step 31: Enter @Re in the position shown in the picture and press Enter (the function will be completed automatically after pressing Enter)

After completion, it looks like this:

Step 32: Complete the rest according to the picture.

@RequestMapping indicates where it comes from, and ("/") indicates from the current directory, return "a1", this should be the same as

The jsp you created before should be consistent.

Step 33: Click the second step as shown in the picture to display the content on the right

Step 34: Copy the following code snippet into the content on the right.

spring.mvc.view.prefix = /WEB-INF/views/
spring.mvc.view.suffix = .jsp

The copying is completed as shown in the figure:

Step 35: Click as shown in the figure and run

After running, you will see the picture below, indicating that the operation is successful.

Sometimes we will see the following situation:

Don't panic, this is because the interface is occupied. To put it bluntly, you used it before but did not turn it off.

The solution is also very easy, just change 8080 to any other number (any number)

Step 36: We just need to search localhost:8081 on Baidu, as shown in the figure

The sentence we entered before will appear.

Okay, the rapid web development has been explained.

Subsequent articles:

Part 3: ❤Three ways to overlook backend data reception❤ (recommended collection)

Part 2: Play with web form rapid web development (❤ Recommended collection ❤)

This concludes this article on entry-level JavaScript web page development. For more relevant JavaScript web page content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • A brief discussion on the implementation principle of Webpack4 plugins
  • Web development js string concatenation placeholder and conlose object API detailed explanation
  • Web project development JS function anti-shake and throttling sample code
  • Multiple solutions for cross-domain reasons in web development
  • js to realize web message board function
  • JavaScript article will show you how to play with web forms

<<:  Detailed steps to install Nginx on Linux

>>:  Detailed explanation of web page loading progress bar (recommended)

Recommend

How to install docker on ubuntu20.04 LTS

Zero: Uninstall old version Older versions of Doc...

Implementation of k8s deployment of docker container

Environment: (docker, k8s cluster), continue with...

Detailed explanation of how to install PHP curl extension under Linux

This article describes how to install the PHP cur...

Vue implements setting multiple countdowns at the same time

This article example shares the specific code of ...

MySQL database green version installation tutorial to solve system error 1067

What is the difference between the green version ...

Three strategies for rewriting MySQL query statements

Table of contents Complex query and step-by-step ...

A brief understanding of the differences between MySQL InnoDB and MyISAM

Preface MySQL supports many types of tables (i.e....

Summary of MySql storage engine and index related knowledge

Storage Engine What is a database storage engine?...

The difference between MySQL database stored procedures and transactions

Transactions ensure the atomicity of multiple SQL...

Detailed explanation of data type issues in JS array index detection

When I was writing a WeChat applet project, there...

MySQL 8.0.21 installation and configuration method graphic tutorial

Record the installation and configuration method ...

JavaScript uses setTimeout to achieve countdown effect

In order to enhance the ability to write JavaScri...

Zabbix redis automatic port discovery script returns json format

When we perform automatic discovery, there is alw...