JavaWeb (a) - web server, Tomcat Installation and Configuration

1. Basic Concepts

1.1 Introduction

web development:

  • web is a web of meaning

  • Static web:

    • html,css
    • Available to all who see the data does not always change
  • Dynamic Web :

    • Taobao, almost all websites
    • Available to all who see the data always vary . Each person at different times, different places to see information varies
    • Technology stack: Servlet / JSP, ASP, PHP

In Java, dynamic web technology resource development collectively referred to as Javaweb

1.2 web application

web applications: to provide browser access to applications

  • a.html, b.html ... more web resources, these web resources can be accessed by the outside world, the outside world to provide service

  • This unified web resources will be placed in the same file, web applications -----> Tomcat: server

  • A web application by a plurality of parts

    • html,css,js
    • jsp,servlet
    • java program
    • jar包
    • Profiles (Properties)
      subsequent to the preparation web application, if you want to provide access to the outside world: the need for a unified server management

Static web 1.3

  • .htm, suffix .html these pages, if these things persist on the server, through the network, we can directly read
    Here Insert Picture Description

  • The disadvantage of static web presence

    • web interface can not dynamically update , all users see the same interface
    • It can not interact with the database (data not persistent, the user can not interact)

Dynamic web 1.4

  • Page will dynamically show: "web page showing results vary"
    Here Insert Picture Description

  • Disadvantage of dynamic web presence

    • Join a dynamic web server error occurred resources, need to rewrite daemon, republish
  • Advantage of the presence of dynamic web

    • web pages can be dynamically updated , all users see the same page
    • It can interact with the database (data persistence: registration, product information, user information ...)
      Here Insert Picture Description

2. web server

2.1 technical explanation

ASP:

  • Microsoft: ASP is the earliest popular
  • VB scripts embedded in HTML, ASP + COM
  • In ASP development, the basic page has a few thousand lines of code business page and chaos
  • High maintenance costs
  • C#
  • IIS: Internet Information Services is running Microsoft Windows-based Internet basic service provided by Microsoft Corporation

PHP:

  • PHP development is very fast, very powerful, cross-platform, code is very simple (70%, WP)
  • The situation can not carry a large amount of access (limitations)

The JSP / the Servlet:
B / S: browser and server
C / S: Client and server

  • the main push sun B / S structure
  • Java-based language (all the big companies or some open source components are written in Java)
  • It can carry three high impact problems caused by
  • Like ASP syntax

2.2 web server

The server is a passive operation, and for some requests the user information processing user some response
IIS
Microsoft; ASP ..., Windows comes with
Tomcat
Here Insert Picture Description
oriented programming Baidu;

Tomcat is a core project of the Apache Software Foundation (Apache Software Foundation) in Jakarta project by the Apache, Sun and other companies and individuals to develop from. Thanks to Sun's involvement and support, the latest Servlet and JSP specifications can always be reflected in Tomcat, Tomcat 5 supports the latest Servlet 2.4 and JSP 2.0 specification. Because Tomcat advanced technology, stable performance, and it's free, so loved by fans of Java and has been recognized by some software developers become more popular Web application server.

Tomcat server is a free open source Web application services , a lightweight application server belongs, is widely used in many occasions are not small and medium systems and concurrent user access is the preferred development and debugging JSP program. For a beginner, it is the best option.

Tomcat JSP pages are actually running and Servlet. Tomcat 9.0 is the latest version of
...

3. Tomcat

3.1 install Tomcat

Tomcat official website: https: //tomcat.apache.org/
Here Insert Picture Description
first decompression after installation
Here Insert Picture Description
in order to regulate, preferably after decompression into a folder of the Environment
Here Insert Picture Description

3.2 Tomcat startup and configuration

Folder action:
Here Insert Picture Description
Start Tomcat

  • Click startup.bat files in the bin directoryHere Insert Picture Description
  • Then enter http: // localhost: 8080 / test access
    Here Insert Picture Description
    close Tomcat
    Here Insert Picture Description
    garbage problem:
    the Apache-Tomcat-9.0.24 \ conf \ the logging.properties
    Here Insert Picture Description
    For ease of use, configure the environment variables
    Here Insert Picture Description

3.3

Here Insert Picture Description
You can configure the port number to start

  • The default port number for tomcat: 8080
  • mysql:3306
  • http:80
  • https:443
    Here Insert Picture Description

You can configure the host name

  • The default host name: localhost-> 127.0.0.1
  • The default web applications storage location: webapps
    Here Insert Picture Description

Difficult interview questions:
talk about how the site is accessed!
(1) enter a domain name, press the Enter key
(2) Check the native C: \ Windows \ System32 \ drivers \ etc \ There are no hosts under the domain mapping profile
① are: direct return ip address corresponding to this there are web addresses in the program we need, you can directly access
② no: DNS server to find, to find the words to return, can not find the returns can not find
Here Insert Picture Description
(3) you can configure the environment variable (optional)

3.4 publish a web site

Not just to imitate

  • Web application file will write their own Web site, into the server (Tomcat) specified folder (webapps) down, you can access a
    folder such as create a rootstudy file
    Here Insert Picture Description
    , double-click index.html, shown below webpage
    Here Insert Picture Description
    website should be some structure
--webapps :Tomcat服务器的web目录
 -ROOT
 -rootstudy :网站的目录名
  - WEB-INF
   -classes : java程序
   -lib:web应用所依赖的jar包
   -web.xml :网站配置文件
  - index.html 默认的首页
  - static 
            -css
             -style.css
            -js
            -img
         -.....
Published 62 original articles · won praise 2 · Views 2734

Guess you like

Origin blog.csdn.net/nzzynl95_/article/details/104157933