1. The JavaWeb concept

  • JavaWeb is the generic name for all programs written in the Java language that can be accessed through a browser.
  • JavaWeb is developed based on request and response.

2. What is a request

Request means that the client sends data to the server, which is called a Request.

3. What is response

Response is a value: the server sends back data to the client, called Response Response.

4. Relationship between request and response

Requests and responses come in pairs, and for every request there is a response.

5. Web resource classification

Web resources can be divided into static resources and dynamic resources according to different implementation technologies and presented effects.

  • Static resources: HTML, CSS, JS, TXT, MP4 video, JPG image.
  • Dynamic resources: JSP pages, Serviet programs.

6. Common Web servers

7. Mapping between the Tomact server and Servlet versions

8. Introduction to the Tomcat software directory

  • Bin is used to store executable programs of the Tomcat server
  • Conf is used to store configuration files of the Tomcat server
  • Lib is used to store jar packages for the Tomcat server (jar packages: specifications for javaEE implementations, j stores ava classes).
  • Logs Is used to store the log information output when the Tomcat server is running (records of a certain month in a certain year).
  • Temp stores temporary data generated when Tomcat is running and will be released after the project is complete.
  • Webapps are designed to host deployed Web projects. (Inside a directory a project)
  • Work is the Tomcat work-time directory, the directory for Tomcat runtime JSP translation source to servlets, and Session passivation (serialization and deserialization of objects). Compile a JSP file into a Java file, and edit it into a class file, new out of an object, to call the methods in the object.

9. How do I start the Tomcat server

  • Locate the startup.bat file in the bin directory of the Tomcat directory and double-click it to start the Tomcat server.

  • How do I test the success of Tomcat server startup?

  • Open a browser and enter the following address in the browser address bar (find the local address) :

  • Port 8080 must be used because the protocol and port number of the accessed browser are set in the server.xml file in the conf (configuration file) in the Tomcat7 directory

    • Port =”8080″ protocol=”HTTP/1.1″ port=”8080″
    • Define A SSL HTTP/1.1 Connector on port 8443
      • http://localhost:8080
      • http://127.0.0.1:8080
      • Http://own laptop is really IP :8080

      The startup is successful if the following page is displayed:

10. Common startup failures

  • Double-click the startup.bat file and a small black window appears.
  • Most of the time, the JAVA_HOME environment variable is not configured properly.

11. Common JVAV_HOME configurations are incorrect

  • JAVA_HOME must be all uppercase
  • JAVA_HOME must have an underscore in the middle, no minus sign
  • You only need to configure the JAVA_HOME directory to the JDK installation directory. You don’t need to take the bin directory.

12. Another way to start the Tomcat server

  1. Open the command line
  2. CD to your Tomcat bin directory
  3. Enter the start command catalina run

13. Stop the Tomcat server

  1. Click the Tomcat close button
  2. Set the Tomcat window to the current window and press the shortcut key Ctrl + C
  3. Double-click shutdown.bat in the bin directory of Tomcat to stop the Tomcat server (main)

14. How do I change the Tomcat port number

  • Mysql default port number: 3306
  • The default Tomcat port number is 8080
  • The default HTTP port number is 80http://www.baidu.com:80

Go to the conf directory under the Tomcat directory, go to the sever. XML and find the Connector tag

Change port 8080 to the port number you want.

14. How do I deploy a Web project to Tomcat

  1. The first deployment mode: just copy the web project directory to the Webapps directory of Tomcat.

    • Create a Test project in the WebApps directory

    • Put the morning submission form in the Test folder

    • How to access the Tomcat Web project?

      Enter http://localhost:8080 in the address bar of the browser to indicate that the query path is in the Webapps directory under the Tomcat directory.

      At this time to access the Test project (i.e., the Test folder), directly after the address and the file name http://localhost:8080/Test/ key: form validation. HTML

  2. In the second deployment mode, find D:\Tomcat7\conf\Catalina\localhost in Tomcat and create the configuration file in this directory

    This is the format of the configuration file at the bottom

16. Default access projects and default access resources

  • When we son ah browser address bar input access address as follows:

    If http://ip:port/ does not have a project name, the ROOT project is accessed by default.

  • When we enter the browser address bar the access address is as follows:

    http://ip:port/ Project name/No resource name, default access to the index.html page.

17. Integrate the Tomcat server with IDEA

  1. Find the application server under Build, Execute, deploy in the Settings of IDEA
  2. Click the + sign in the upper part, select the Tomcat server, and locate the Tomcat software on your computer in the Tomcat home directory in the dialog box that is displayed.
  3. After the primary Tomcat directory is filled in, the base Tomcat directory is filled in by itself, and the Tomcat version number is displayed in the middle
  4. The next time you create a module, the application server column can select the Tomcat file you just configured

18. How to create a dynamic Web project

  1. Create a new module: first the project, then the module select the Java Enterprise select the application server, select the Tomcat version file you just configured
  2. Select what type of module to create: Select #Web module to create.


——– to see the big guys can pay attention to xiaobian, will always update tips, free to share with you!! ——— click on the planet to quickly enter the Github planet!! There are more fun technologies to explore!