当前位置:网站首页>Detailed explanation of the principles and differences between static pages and dynamic pages
Detailed explanation of the principles and differences between static pages and dynamic pages
2022-07-25 01:51:00 【Xiao Guangbiao】
Detailed explanation of the principles and differences between static pages and dynamic pages
One 、 static state web page
1、 In static Web In the program , Client side usage Web browser (IE、FireFox etc. ), Use HTTP The protocol initiates a request , Tell the server which page I need to get now , after WEB Server according to the needs of users , From file system ( The disk that holds all the static pages ) Take out the content . After through Web The server returns to the client , After the client receives the content, it is rendered and parsed by the browser , Get the effect shown .
2、 To make it static web The page looks better , Use javascript/VBScript/ajax, But these special effects are displayed to users on the client side with the help of a browser , So there's no change in the server itself .
3、 static state web Unable to connect to database ;
4、 static state web Resource development technology :HTML;
5、 Because of the present web On the page , A lot of use JS, Causes the browser to open the page , It takes up a lot of memory , The pressure on the server is reduced , But the pressure shifted to the client .
Two 、 dynamic web page
1、 dynamic WEB in , The program still uses the client and the server , The client still uses the browser (IE、FireFox etc. ),, Use HTTP The agreement initiates the request , Now all the requests go through one WEB Server To deal with it .
2、 If the client requests static resources (.htm Or is it .htm), The request is forwarded directly to WEB The server , after WEB The server pulls content from the file system , Send it back to the client browser for parsing execution .
3、 If the client requests dynamic resources (.jsp、.asp/.aspx、.php), Then forward the request to WEB Container(WEB Containers ), stay WEB Container Connect to database , After a series of operations, such as fetching data from the database, the display content of the dynamic patching page , After piecing together the display content of the page , Give all the presentation to WEB The server , After through WEB The server sends the content back to the client browser for parsing .
Further in-depth analysis of the dynamics web Access process : Browser access web when , It seems to be directly accessed jsp page , It's actually , The first place to arrive is the server , The server is created req and resp Object before giving jsp Page using . stay jsp After setting the character set and obtaining the form parameters, call servlet, Complete business processing . Then return to jsp,jsp It will generate the corresponding html page . This page will return to the server , And then by the server , adopt response Object returned to client .
Why web The server ?(web server)
1) No matter what web resources , Want to be accessed by a remote computer , There must be a corresponding network communication program , When users come to visit , This network communication program reads web Resource data , And send the data to the visitors .
2)WEB The server is such a program , It is used to complete the underlying network communication , Handle http agreement . Use these servers ,We Application developers only need to pay attention web How to write resources , You don't need to care about how resources are sent to the client , This greatly reduces the development workload of developers .
Common news web Resource development technology :JSP/Servlet、ASP、PHP etc. .
3、 ... and 、 On the difference between the two
1、 Static page is that the designer sets everything on the page 、 Then put it on , No matter who sees the page content at any time ( Unless you manually modify the content of the page ). static state html pagefile , You can open it directly with your local browser . such as :file:///Users/Phil/Documents/DevOps/HBuilderProjects/testJSP/index.html.
2、 The contents of dynamic pages are generally generated by server-side programs , Different people 、 Visit the page at different times , The content displayed may be different . After the web designer has written the page program on the server side , No manual control is required , The page content will be automatically changed and transformed according to the arrangement of the page program .
3、html yes w3c A standard web page writing format , Is a unified protocol language , Static web page . The web pages we read online are mostly based on html Linguistic .
jsp It is based on dynamic language ,jsp Can achieve html All the tasks of ,
4、HTML(Hypertext Markup Language) Text markup language , It's a static page , and JavaScript The same interpretative language , Why is it interpretative language ? because , As long as you have a browser, it can be displayed normally , You don't need to specify a compiler , Just in TXT Write... In the document HTML The mark can be displayed normally .
JSP(Java Server Page) yes Java Server side page , So it's dynamic , It needs to go through JDK After compiling, send the content to the client to display , We all know ,Java After the file is compiled, a class file , This is the final execution class file .
5、JSP The predecessor was servlet;
6、html and jsp The header is different , This is JSP The head of the “ <%@ page language=“java” import=“java.util.*” pageEncoding=“gbk”%>” In the header, there are coding format, pouring package, etc . It's also easy to distinguish , stay jsp of use <%%> You can write Java Code. , and html No, <%%>.
7、, incognizance jsp perhaps asp What's that , But sometimes the interface needs logical control , So we use the corresponding technology to realize , This is more convenient . and jsp In the background, it is resolved to the corresponding... Through the server html, Then it is displayed for the browser to recognize . for example
<%
if(flag == a){
<label>a<label>
}else {
<label>b<label>
}
%>
After the server reads this code , According to the corresponding business logic , Compile into the corresponding servlet, Again by servlet Output to page ( The output is html).
Four 、 Experimental tests
1、 stay HBuilder Created in jsp page , It's built in web Static server cannot resolve jsp Header , Output can only be displayed as text , But you can parse the html part . The browser cannot be opened directly jsp file .jsp If the page wants to display correctly , need web The container is parsed .
2、 stay IntelliJ Created in web application, Need to start the tomcat, To run jsp, It can be parsed smoothly jsp The header .
Last
If help , Like and focus on !
边栏推荐
- Why is the exclude or include attribute setting of the < keep alive > component invalid
- Origin and development of philosophy Hegel external historical form
- Grpc sets connection lifetime and server health check
- G024-db-gs-ins-01 openeuler deployment opengauss (single instance)
- Hbuilderx developed by uni app connects to night God simulator
- About the relationship between parent process and child process (UAC bypass idea)
- Standard transfer function
- [hero planet July training leetcode problem solving daily] 20th BST
- The most complete summary of MySQL data types in history - (first)
- Data integration | what are the tools for data integration at home and abroad?
猜你喜欢

Inventory of well-known source code mall systems at home and abroad
![[programmer interview classic] 01.09 string rotation](/img/d2/7ea9351c31af01665d86f8c6bc3468.png)
[programmer interview classic] 01.09 string rotation

Luo min cannot become Dong Yuhui
![[development tutorial 10] crazy shell · open source Bluetooth smart health watch OTA image production and download technical documents](/img/97/c4ef281ca14eb68c8a14f18e03c3dd.png)
[development tutorial 10] crazy shell · open source Bluetooth smart health watch OTA image production and download technical documents

Worthington carboxyl transfer carbonic anhydrase application and literature reference

VC hesitates to invest in Henan

Multi species tissue slide prosci pancreatic tissue solution

Rightmost × Microframe, high quality heif image coding and compression technology

Green low-carbon Tianyi cloud, a new engine of digital economy!

Promise basic use
随机推荐
Custom type
Application status of typical marine environmental observation data products and Its Enlightenment to China
6-11 vulnerability exploitation - use the built environment to send emails
Promise basic use
How can arm access the Internet through a laptop?
Top priority of dry goods: common indicators and terms in data analysis!
10 commonly used data visualization tool software
Target segmentation for 10000 frames of video, less than 1.4GB of video memory, open source code | ECCV 2022
Common functional interfaces_ Predicate interface_ Default method and and predicate interface exercise_ Set interface filtering
If in ython__ name__ == ‘__ main__‘: Function and principle of
PG Optimization -- execution plan
Several application scenarios of NAT
The introduction of 23 Filipino doctors for 18million was a hot topic, and the school teacher responded: expedient
[development tutorial 10] crazy shell · open source Bluetooth smart health watch OTA image production and download technical documents
Grpc sets connection lifetime and server health check
[summer daily question] Luogu p1605 maze
Human cell prosci 4-1BB ligand recombinant protein scheme
Worthington carboxyl transfer carbonic anhydrase application and literature reference
Plug ins QRcode and ityped
The two supply chain centers of HEMA launched the "background" of innovative research and development of multi format commodities