Home Web Front-end HTML Tutorial Getting Started with JavaWeb for Rookies 1 (My own learning and understanding, please give me some advice from experts if I'm wrong)

Getting Started with JavaWeb for Rookies 1 (My own learning and understanding, please give me some advice from experts if I'm wrong)

Sep 15, 2016 am 11:15 AM

1. Relevant basic knowledge

1. C/S (Client/Server) architecture and B/S (Browser/Server) architecture

First of all, let’s talk about the C/S architecture. To put it simply, it is very common. Applications such as QQ that require downloading clients are built on the C/S architecture. To go deeper, it is a distributed architecture. Each client directly connects to the database server, and data processing depends on the client. Therefore, we often see QQ getting stuck while using it. As a result, the following problems will arise when choosing C/S architecture during software development:

1) All clients connect to the database concurrently, which directly limits the number of client programs running at the same time.

2) It needs to be installed, which is troublesome. (However, this cannot stop the popularity of various apps now)

3) Once Party A needs to update the software, all client computers need to be updated as well. (Baidu Browser (mobile version) pops up update prompts every day, which is annoying, and there is no button to turn off updates. In fact, it is good to update QQ every once in a while. The consequence of updating too frequently is that I finally abandoned Baidu Browsing. Device (mobile version))

The second is the B/S architecture, which is an improved version of the C/S architecture. For example, many online videos no longer require client installation. As long as you have a browser, all WEB services are performed on the browser. Its connection with the database goes through a door: client-web server (door!)-database server. In this way, the number of clients connecting to the database at the same time is not limited. By the way, B/S architecture is now the preferred choice for many information management systems. I am also planning to choose this architecture for my graduation project this year. Come on, boy!

(The following are all based on B/S architecture)

2. Communication protocol

As mentioned above, the B/S architecture will go through one door: the web server (not the database server yet), then when developing applications, it will always involve the interaction between the browser and the server. The process is as follows: Client browser --Send a request to the server--The server processes the request--The server returns the response result--The client browser receives the response result (actually equivalent to clicking a link when you go online, and then the browser pops up a page you want this process). Two things are involved: URL address and HTTP protocol. More details later

3. Web resources

There are many resources in the web server that can be accessed by the outside world. According to the different rendering effects, they are divided into static resources (HTML, css, jpg, etc.) and dynamic resources (jsp, Servlet, etc.). In fact, it does not mean that static resources are motionless. Dynamic means that the accessed resources change over time. The content will change (for example, the number of train tickets will be different each time you go to see it).

(Most of the following are related to the development of dynamic resources)

4. Tomcat server

It’s still a Web server (still not a database server). In fact, there are many different types of servers (Apache, IIS servers), used for enterprises, used for teaching, etc. The difference in my opinion is the processing The capabilities of data are just different (I probably don’t know it because I’m still inexperienced at the moment). Among them, tomcat is a lightweight web server under Apache that is often used for web development and learning. It not only has the basic functions of a web server, but also provides many components such as database connection pools. (Why is there a tomcat server? If you want to develop a dynamic web page, you have to run it on major browsers to see how it goes. So how does a web page run on the Internet? It is very simple, just enter the URL and click it, that is Say you sent a request, but if you want to get the result, that is, if you want others to respond to you, you need a WEB server, and the resources you have prepared and can be responded to have been saved in it. Only then can you get Output the result of your request. After all, the result is the dynamic web page you developed)

How to install and use tomcat server, I won’t go into details here. But I can give you a rough idea of ​​what files will appear on your computer after installation.

1) bin: used to store executable files and script files of tomcat. For example, the exe file (starup.bat) that starts tomcat is placed in it. Just double-click starup.exe to start tomcat

2) conf: used to store some configuration files, such as web.xml, server.xml (there is a difference between xml and HTML language. XML language is used to describe the nature and structure of data, and HTML language is used to display data)

3) lib: used to store jar packages

4) logs: used to store tomcat log files

5) temp: temporary file

6) webapps: The main publishing directory of web applications (that is, web resources running on the web server, which are the page files you develop) is placed here. In other words, the developed web files are here. When the browser user requests At this time, it is to request the file resources here. At the same time, one thing to note is that web applications placed in the webapps directory can be directly accessed by the outside world. Simply put, if you click http://127.0.0.1:8080 (the default port number is 8080) in the address bar to enter the web page and see a cat, it means that tomcat has been successfully started, and it means that it is already in the webapps directory. Well, if you put the web page you developed in webapps, such as welcome.jsp, then if you want to open the web page you developed, you only need to enter the web page under the premise of the server to get the correct address: http://127.0.0.1: 8080/welcome.jsp So, can the address be changed? Yes, see below

7) work: working directory

5. Configure the web application virtual directory

Not satisfied with the address of a webpage you developed and want to change it? OK, configure a virtual directory (because you are not actually placing the files in this directory (still under webapps), so the directory at this time is called a virtual directory)

1) Configure the virtual directory in the server.xml file (as mentioned above, xml files are used to describe the nature and structure of data, not for display)

Open the server.xml file in Notepad format, and then add the following code:

Add The file name refers to the starting directory that appears as soon as you open the server, that is, you put The position of webapps has been taken up

Note: after saving the file, you need to restart tomcat for it to take effect

This article ends first, and we will start the next one

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Apr 04, 2025 pm 11:54 PM

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

How to implement adaptive layout of Y-axis position in web annotation? How to implement adaptive layout of Y-axis position in web annotation? Apr 04, 2025 pm 11:30 PM

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...

HTML, CSS, and JavaScript: Essential Tools for Web Developers HTML, CSS, and JavaScript: Essential Tools for Web Developers Apr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

How to use CSS3 and JavaScript to achieve the effect of scattering and enlarging the surrounding pictures after clicking? How to use CSS3 and JavaScript to achieve the effect of scattering and enlarging the surrounding pictures after clicking? Apr 05, 2025 am 06:15 AM

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...

See all articles