JavaWeb Getting Started Guide: Start Your Web Development Journey



foreword

This blogger will use CSDN to record the experience and knowledge he has personally gained and learned on the way to study software development. Interested friends can pay attention to the blogger!
Perhaps a person can go fast alone, but a group of people can go farther!


1. The concept of JavaWeb

1. What is Java Web?

  1. Java Web refers to web applications developed using the Java programming language. Typically, such applications run on a Java web server (like Apache Tomcat, Jetty, etc.) rather than a JVM on the local machine.
  2. Java web applications are typically developed using Java web technologies such as Java Servlet, JavaServer Pages (JSP), Java Server Faces (JSF), and Java web frameworks such as Spring and Struts. These technologies enable developers to create dynamic Web pages and Web applications that handle operations such as form submissions and queries to databases. Java web applications have the advantages of strong scalability, high stability, and good security, so they are widely used in enterprise-level web application development.
  3. In layman's terms, the general term for all programs written in the Java language that can be accessed through a browser is called JavaWeb. JavaWeb is developed based on requests and responses.

2. What is a request

  1. Request means that the client sends data to the server, which is called Request.
  2. It is a command sent by the client (usually a browser) to the server to obtain a certain resource or perform a certain operation. For example, when you enter a URL address in the browser and press the Enter key, the browser will send an HTTP request to the server to obtain the corresponding Web page. Requests usually include HTTP method (such as GET, POST, etc.), URL address, request header, request body and other information, which can help the server determine what response should be provided to the client. Web application developers typically map requests to specific handlers, or servlets, that process the request and return a response.

3. What is a response

  1. Response means that the server returns data to the client, called Response.
  2. In web development, the response refers to the data sent by the server to the client after receiving the request sent by the client, in response to the client's request. For example, when you enter a URL address in the browser and press the Enter key, the browser will send an HTTP request to the server, and the server will generate a corresponding Web page according to the request and return it to the browser. The page is the response. The response usually includes HTTP status code (such as 200 means success, 404 means not found, etc.), response header, response body and other information, which can help the client correctly process the data returned by the server. In web application development, developers usually write code that processes requests, generates corresponding responses, and sends response data to clients.

4. The relationship between request and response

  1. Requests and responses come in pairs, where there is a request, there is a response.
  2. Request and response are two fundamental concepts in web applications. A request is an instruction sent by the client (usually a browser) to the server to obtain a resource or perform an operation, and a response is the data sent by the server to the client in response to the client's request. In Java Web development, the Web container (such as Tomcat) will receive the request and forward it to the corresponding Servlet or JSP page, and then these pages will process the business logic according to the requested information and generate the response content, and finally send the response content back to the client browser , the browser renders the response content and displays it on the user's screen.
    insert image description here

2. Classification of Web resources

Web resources are divided into static resources and dynamic resources according to the different technologies and presentation effects.

1. Static resources

  1. Static resources include html, css, js, txt, mp4 videos, jpg pictures, etc.
  2. Static resources refer to resources that can be directly presented to the client without processing on the server side. When a static resource is requested by the client, the server only needs to send it to the client without additional processing.

2. Dynamic resources

  1. Dynamic resources include jsp pages, Servlet programs, etc.;
  2. Dynamic resources refer to resources that need to be processed on the server side before being presented to the client. When a client requests a dynamic resource, the server will process it according to the requested parameters and logic, generate dynamic content and then send it to the client. The advantage of dynamic resources is that content can be dynamically generated according to different user requests, which increases the flexibility and interactivity of the website.

By combining static resources and dynamic resources, richer and more complex web applications can be realized. Static resources are usually used to present the structure and style of the page, while dynamic resources are used for functions such as processing user requests, generating dynamic content, and interacting with databases.

3. Commonly used web servers

  1. Tomcat: A Web server provided by the Apache organization, providing support for jsp and Servlet. It is a lightweight javaWeb container (server) and the most widely used JavaWeb server (free).
  2. Jboss: It is an open source, pure Java EJB server that complies with the JavaEE specification, and it supports all JavaEE specifications (free of charge).
  3. GlassFish: A JavaWeb server developed by Oracle Corporation, is a robust commercial server, to achieve production-level quality (few applications).
  4. Resin: It is a product of CAUCHO company, it is a very popular server, it provides good support for servlet and JSP, and its performance is relatively good, resin itself is developed by JAVA language (fees are charged, and there are many applications).
  5. WebLogic: It is a product of Oracle Corporation. It is the most widely used Web server at present. It supports the JavaEE specification and is constantly improved to meet new development requirements. It is suitable for large projects (fees are charged, not used much, and suitable for large companies).

Guess you like

Origin blog.csdn.net/weixin_52533007/article/details/131676019