First, relevant basic knowledge
1, c/S (client/server) architecture and B/s (browser/server) architecture
First of all, the C/s architecture, simple speaking is actually very common, like QQ and other needs to download the client application is built in the C/s architecture. To a deeper point, it is a distributed architecture, each client directly connected to the database server, and the processing of data needs to rely on the client, so we often see QQ with the use of the card is dead. As a result, the following problems arise when choosing the C/S architecture for software development:
1) All clients concurrently connect to the database, which directly limits the number of simultaneous client programs to run.
2) need to install, trouble. (However, this does not stop the popularity of various apps now)
3) Once you need to update the software, you need to update the vast number of clients. (Baidu Browser (mobile phone) every day out of the update prompt is also very annoying, there is not a button to close the update, in fact, similar to QQ every time to update is very good ah, too often the consequences of the update is the end I abandoned Baidu browser (mobile))
The second is the B/s architecture, which is a modified version of the C/s architecture. For example, there are many online videos that do not have to install the client, as long as you have a browser, that all Web services are on the browser. Its connection to the database has gone through a door: client--web server (door!) )--The database server, so that the number of simultaneous client connections to the database is not limited. By the way, now a lot of information management system preferred B/s architecture, I this year's graduation design is also ready to choose this architecture, refueling it, juvenile!
(The following are based on the B/S architecture)
2. Communication protocol
It says, b/s architecture will go through a door: the Web server (not the database server), then the development of the application, always involves the interaction between the browser and the server, The process is as follows: client browser--send request to server--server side processing request--server side return response result--the client browser receives the response result (in fact, it is equivalent to you click a link on the Internet, and then the browser jumps out of the page you want the process). It involves two things: a URL address and an HTTP protocol. Detailed later
3. Web Resources
There are many resources available in the Web server for external access. Depending on the rendering effect is divided into static resources (HTML, CSS, JPG, etc.) and dynamic resources (JSP, servlet, etc.), in fact, is not to say that static resources is motionless, where the dynamic meaning is over time, The content of the visit changes (such as the number of tickets each time you go to the train is different).
(Most of the following are related to the development of dynamic resources)
4. Tomcat Server
or a Web server (still not a database server OH), in fact, there are many different types of servers (Apache, IIS Server), for the enterprise, for teaching, and so on, the difference in my opinion is the ability to deal with the data is different (it should be I am not aware of the shallow at present). Tomcat is a lightweight Web server that is commonly used for web development learning under Apache. It not only has the basic function of Web server, but also provides many components such as database connection pool. (Why should I have a tomcat server?) You want to develop a dynamic Web page, always run on each big browser to see how it works, then how does a webpage run on the internet? Very simple, enter the URL click on the line, that is, you send a request, but you want to get the result, that is, to give you a response, you need to have a Web server, and which has saved your good, can give a response to the resources, then you can draw the results of your request. In other words, the result is the Dynamic Web page you developed! )
How to install and use the Tomcat server, this is not said. But I can probably tell you what files will appear on your computer after installation.
1) Bin: The executable file and script file for Tomcat, such as the EXE file that launches Tomcat (Starup.bat) 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 the HTML language and the English, the XML language is used to describe the nature and structure of the data, the HTML language is used to display the data)
3) Lib: For storing jar packages
4) Logs: Log file used to store tomcat
5) Temp: Temp file
6) The main publishing directory of the Webapps:web application (which is the Web resource running on the Web server, which is the paging file you developed) is here, that is, the Web file being developed here, when the browser user requests it, the file resource is requested here. It is also important to note that Web applications placed in the WebApps directory can be accessed directly by the outside world. Simply put, you now click on the Address bar http://127.0.0.1:8080 (the default port number is 8080) to go to the Web page to see a cat, it means that Tomcat has been successfully launched, this means that it is already in the WebApps directory, So if you put the Web page you developed in WebApps, such as welcome.jsp, then you have to open the Web page you developed as long as the server to enter the Web page to get the correct address: http://127.0.0.1:8080/welcome.jsp Then, Can I change the address? Yes, and see below
7) Work: Working directory
5. Configure the Web App virtual directory
Not satisfied with the address of a webpage you develop, want to change? OK, configure a virtual directory (because you are not actually putting the file in this directory (or under WebApps), so this time the directory is called the virtual directory)
1) Configure the virtual directory in the Server.xml file (it says that the XML file is used to describe the nature and structure of the data, not for display)
Open the Server.xml file in Notepad format and add the following code:
<Host> add <context path= "/file name" docbase= "d:\ file name"/> Where the file name refers to the start directory you want to open the server to, that is, you take the location of the WebApps taken away
Note that you need to restart Tomcat to take effect after saving the file.
This one's over, and the next one.
The javaweb of the beginner's study of vegetable dishes 1 (your own learning comprehension, the wrong place please the great God to teach a lot of AH)