Talk about Apache, Tomcat && static pages, Dynamic Web pages

Source: Internet
Author: User
Tags character set html page html tags php and tomcat
Apache & Tomcat Apache 1, C language implementation, specifically for the provision of HTTP services. 2, Characteristics: simple, fast, stable performance, configurable (proxy), mainly used to resolve static text, high concurrency performance, focusing on HTTP services; 3, Support static page (HTML), does not support dynamic requests such as: CGI, servlet/jsp, PHP, ASP, etc.; 4, with strong scalability, can be supported by the plug-in PHP, but also a one-way Apache connection tomcat to achieve connectivity. Apache is the first Web server in the world to use. Tomcat 1. Java-developed JSP server (Servlet container), which is an SDK-compliant servlet specification, is an extension of Apache. Free Java Application Server 2, mainly used for parsing jsp/servlet, focusing on the Servlet engine; 3, support static page, but efficiency without Apache high; Support servlet, JSP request; 4. Tomcat itself also has a built-in HTTP server to support static content and can be integrated with Apache through Tomcat's configuration management tool. Apache + Tomcat: The advantages of combining the two: If the request is a static web page, it is processed by Apache and returns the result, and if it is a dynamic request, Apache forwards the parsing work to Tomcat processing, and the result is returned via Apache after Tomcat processing. This can achieve the division of labor, to achieve a long load scale, improve the performance of the system. Apache is a Web server environment program that can be used as a Web server. However, only support static Web pages, such as (asp,php,cgi,jsp) and other dynamic Web pages, it seems powerless. If you want to run JSP in the Apache environment, you need an interpreter to execute the JSP Web page, and this JSP interpreter is Tomcat, but also need to jdk,jsp to connect the database, the JDK to provide a connection to the database drive, Therefore, to run the JSP Dynamic Web server platform requires APACHE+TOMCAT+JDK. static pages & Dynamic Web pages static Web pages: 1. In a static Web program, the client uses a Web browser (IE, Firefox, etc.) to connect to the server via the network, using the HTTP protocol to initiate a request, telling the server which page I need to get now, All requests are given to the Web server, and then the Web server extracts the content from the file system (the disk that holds all the static pages), depending on the user's needs. After the Web server is returned to the client, the client receives the content after the browser rendering parsing, to get the effect displayed. 2, in order to make the static page display more beautiful, using Javascript/vbscript/ajax (Ajax is "Asynchronous JavaScript and XML" (Asynchronous JavaScript and XML), is a web development technique that creates an interactive Web application. However, these effects are presented to the user via the browser on the client, so there is no change on the server itself. 3, static page can not connect to the database; 4, because of the current Web page, a large number of use of JS, causing the browser to open the page, will occupy a lot of memory, the pressure on the service side is reduced, but the pressure shifted to the client. 5, running on the client's programs, Web pages, plug-ins, components, belonging to static Web pages, such as: Html,javascript, and so on, they can run out of the server browser client. 6: Static Web page content is relatively stable, the URL address relative to the Dynamic Web page is more easily recognized by the search engine, so the site SEO optimization is generally recommended to use static Web pages. 7: Static Web pages do not require database support, so the speed of access is faster than dynamic Web pages, but as the browser and broadband speed increases, this difference will be less and less. Dynamic Web pages: 1, the Dynamic web, the program still uses the client and the server side, the client still use the browser (IE, Firefox, etc.), through the network (Internet) to connect to the servers, using the HTTP protocol to initiate requests (request), all the requests now go through a web Server to process. 2. If the client is requesting a static resource (. htm or. htm), the request is forwarded directly to the Web server, after which the Web server takes the content out of the file system and sends it back to the client browser for resolution execution.

3, Common Dynamic Web Resources development technology: Jsp/servlet, ASP, PHP and so on. If the client is requesting a dynamic resource (. jsp,. asp/.aspx,. php), the request is forwarded to the Web Container (Web container), the database is connected in the Web Container, After a series of operations, such as extracting data from a database, and then dynamically piecing together the contents of the page, putting together the content of the page, all the content is presented to the Web server, and then the content is sent back to the client browser through the Web server for parsing and execution. 4, further deep analysis of Dynamic Web Access process: Browser access to the Web, it seems to be directly access to the JSP page, in fact, the first place to arrive is the server, the server created good req and RESP objects and then to the JSP page use. JSP is the predecessor of the servlet, in the JSP to complete the setting character set and get form parameters before calling the servlet, complete business processing. Then return to jsp,jsp and the corresponding HTML page is generated. The page is returned to the server, which is returned by the server to the client through the response object.

5, running on the server side of the program, Web pages, components, belong to dynamic Web pages, such as: jsp,asp,php, and so on, they will be different customers, different times, the return of different pages. 6. Why a Web server is required. (Web server) 1) No matter what web resources, want to be accessed by a remote computer, must have a corresponding network communication program, when the user to access, the network communication program read the Web resource data, and send the data to the visitors. 2) Web server is such a program, it is used to complete the underlying network communication, processing the HTTP protocol. Using these servers, we developers need to focus on how the Web resources are written, without caring how the resources are sent to the client, greatly reducing developer effort. a simple description of the difference between static Web pages and dynamic Web pages 1, Static page is the designer of the page all things are set up, do die, and then put up, regardless of who at any time to see the page content is the same, immutable (unless manually modify the page content). Programs, Web pages, plug-ins, and components that run on the client are static Web pages, such as HTML pages, Flash, JavaScript, VBScript, and so on, and they are always the same. A static HTML paging file that can be opened directly from a local browser. For example: file:///Users/Phil/Documents/DevOps/HBuilderProjects/testJSP/index.html. Where static pages can be run. Dynamic pages are not. 2, whether the program is running on the server side, this is to judge the page is not a Dynamic Web page is an important symbol. Dynamic pages need to be interpreted by the server. Dynamic page content is generally based on the server-side program to generate, different people, different times to access the page, the content may be different. After writing the server-side page program, the Web designer does not need manual control, and the page content will change automatically according to the arrangement of the page program. Programs, Web pages, and components that run on the server side are dynamic Web pages that return different pages with different customers, at different times, such as ASP, PHP, JSP, ASP, CGI, and so on. 3, Dynamic Web pages more interactive than static Web pages, you can achieve more features, such as user registration, login and a series of users need to interact with the site function basic needs to be met by Dynamic Web pages. Dynamic Web pages, with various animations on the Web page, scrolling subtitles and other visual "dynamic effect" is not directly related to the Dynamic Web page can also be plain text content, can also contain a variety of animation content, these are only the content of the Web page manifestation, regardless of whether the page has a dynamic effect, Web pages generated using Dynamic Web technologies are called Dynamic Web pages. 4, Dynamic Web page is not a standalone web page on the server, when the user sends the request, the server may also have to piece together other elements to return a complete page, and static Web page once uploaded to the server, is actually saved on the Server Web page file. 5, HTML is a Web page writing format, is a unified protocol language, static Web pages. Most of the pages we look at online are based on HTML language. JSP is a dynamic language based, JSP can implement all the tasks of HTML, 6, HTML (Hypertext Markup Language) Text Markup Language, it is a static page, and JavaScript as the interpretation of language, why is interpreted language. Because, as long as you have a browser then it can be displayed normally, and do not need to specify the compilation tool, just write in the TXT document HTML tags can be displayed normally. The JSP (Java Server page) is a Java service-side page, so it is dynamic, it needs to be compiled by the JDK to send the content to the client to display, we all know that the Java file compiled will produce a class file, the final execution of this class file, 7, HTML and JSP header is not the same, this is the head of the JSP "<%@ page language=" java "import=" java.util.* "pageencoding=" GBK "%>" In the table header there are coded formats and poured into the package. is also very well differentiated, in the JSP with <%%> can write Java code, and HTML does not have <%%>. 8, do not know what JSP or ASP what, but sometimes the interface needs logic control, so we use the corresponding technology to achieve, so it is more convenient. And the JSP in the background through the server resolution to the corresponding HTML, and then in the browser to identify the display. For example

if (flag = = a) {
}else {
% >
After reading this code, the server compiles the appropriate servlet to the corresponding business logic, which is then output by the servlet to the page (the output is HTML). 9, in short, static Web pages suitable for updating fewer sites, generally applicable to the display site, and dynamic Web pages are more updated, generally used for more user interaction sites. static Web page and Dynamic Web page experiment Test 1, create JSP page in Hbuilder, its built-in Web static server cannot parse the JSP header, only as text display output, but can parse the HTML part. The browser cannot open the JSP file directly. The JSP page needs to be parsed by the Web container if it wants to display correctly.

2, create the Web application in IntelliJ, need to start Tomcat, in order to run the JSP, you can successfully parse the JSP table header.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.