Java Topic Notes ~ JavaWeb Overview/Development Basics

 JavaWeb Overview/Development Fundamentals

1.XML basics

(1) Overview of XML

(2) XML syntax

(3) DTD constraints

(4) Schema constraints (XML Schema is more powerful than DTD)

2. Web basic knowledge

Web is a distributed hypermedia information system.

From a technical point of view, Web technology can be divided into client-side technology and server-side technology.

  1. Web client technology

    The main task of the Web client is to present information content.

    Related technologies:

    1. HTML language (content)

    2. CSS style sheet (appearance)

    3. Client-side scripting language - JavaScript (behavior)

  2. Web server technology

    JSP technology

3. Installation and configuration of web development tools

(1)JDK

​ a) Download, go to oracle official website to download

b) install

c) Configure environment variables

​ i. JAVA_HOME

​ ii. Path

(2) Tomcat server

​ Tomcat is a core project in the Jakarta project of the Apache Software Foundation (Apache Software Foundation) , jointly developed by Apache , Sun and some other companies and individuals .

​ Tomcat server is a free and open source web application server. It is a lightweight application server. It is widely used in small and medium-sized systems and occasions where there are not many concurrent access users. It is the first choice for developing and debugging JSP programs.

​ Tomcat官网:Apache Tomcat® - Welcome!icon-default.png?t=N6B9https://tomcat.apache.org/

download and install

 

 

start test

1. Start the service: enter the root directory of tomcat, then enter the bin folder, double-click startup.bat, and the following interface appears

Note: When the connected WiFi cannot access the Internet, the DNS server can be changed, as shown in the figure below: 

   2. Open the browser and enter http://localhost:8080/ in the address bar . If you can see the following interface, it means that the Tomcat server is installed successfully!

Note: The port number of Tomcat is 8080 by default. If it is occupied, the server cannot be used, and the port number of Tomcat needs to be reconfigured.

Modification method: Modify server.xml under conf (tomcat installation directory\conf\server.xml)

<Connector port="8000" protocol="HTTP/1.1"

connectionTimeout="20000"

redirectPort="8443" URIEncoding="UTF-8"/>

learn:

The command to view the port number: netstat -ano or netstat -ano|findstr "8080", find the pid that occupies the port

View the program name corresponding to pid: tasklist |findstr "pid"

4. Publish a static website

1. Write a static web page first: index.html

   <!DOCTYPE html>
   <html>
   <head>
     <title>Bootstrap5 实例</title>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <link href="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/css/bootstrap.min.css" rel="stylesheet">
     <script src="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/js/bootstrap.bundle.min.js"></script>
   </head>
   <body>
     
   <div class="container p-5 my-5 border">
     <h1>我的第一个 Bootstrap 页面</h1>
     <p>这个容器有一个边框和一些边距。</p>
   </div>
   
   <div class="container p-5 my-5 bg-dark text-white">
     <h1>我的第一个 Bootstrap 页面</h1>
     <p>这个容器具有深色背景色和白色文本,以及一些额外的边距。</p>
   </div>
   
   <div class="container p-5 my-5 bg-primary text-white">
     <h1>我的第一个 Bootstrap 页面</h1>
     <p>这个容器具有蓝色背景色和白色文本,以及一些额外的边距。</p>
   </div>
   
   </body>
   </html>

 

2. Create a folder named web, put the above web page in it, and then copy the entire folder to the webapps folder in the root directory of tomcat.

3. Start the tomcat server, enter http://localhost:8080/staticweb/index.html in the address bar , and you can see the following web page

  4. Open the operation through WIN+R, enter cmd, open the command prompt window, enter ipconfig, and check the ip address of the machine.

  5. At this time, all computers in the same LAN can access the above webpage through http://10.5.29.235:8080/staticweb/index.html (change the ip address to your own).

 

Guess you like

Origin blog.csdn.net/qq_53142796/article/details/132194017