In recent years, a large amount of software development activity has migrated from



tải về 2.32 Mb.
Chế độ xem pdf
trang4/16
Chuyển đổi dữ liệu20.09.2022
Kích2.32 Mb.
#184179
1   2   3   4   5   6   7   8   9   ...   16
Core JSP
1.1 A History of the Web 
To understand the power of JSP pages, one must first take a look at the past 
approaches to creating Web pages. 
Static Pages 
With a static Web page, the client requests a Web page from the server and the server 
responds by sending back the requested file to the client. The client receives an exact 
replica of the page that exists on the server (See 
Figure 1–1
). 
Figure 1-1. Standard HTML Document 


Traditional Web pages are static and unchanging. Under normal conditions they will 
always remain the same. Requests from multiple clients for the same static page 
should all receive the same results. 
Dynamic Pages 
Since the earliest days of HTML there has been a need for handling data dynamically. 
It may have started out as simple as providing a feedback form. Today's Web site 
requires a lot more than static content and a feedback form. Dynamic data is important 
to everything on the Web, from online banking to playing games. 
The definition of dynamic content is Web pages that are created at the time they are 
requested, changing content based on specified criteria. For example, a Web page that 
displays the current time is dynamic because its content changes to reflect the current 
time. Dynamic pages are generated by an application on the server, receiving input 
from the client, and responding appropriately (See 
Figure 1–2
). 
Figure 1-2. Dynamic HTML Document 


There have been several methods of generating dynamic data used over the years. 
Understanding the other approaches and their strengths and weaknesses helps to 
understand JSP pages. 
Common Gateway Interface 
The Common Gateway Interface (CGI) is probably the most prolific form of Web 
application in use today. Designed early on in the Web-server era, CGI allows 
requests to be sent to an external program. These external programs could be written 
in just about any programming language—most commonly C, C++, Perl, and Python. 
While CGI is a solution for creating dynamic content on the Web, it has several facets 
that make it very inefficient.CGI programs typically use a large amount of system 
resources; not just CPU usage, but also large amounts of memory. For each request 
sent to a CGI program, the Web server loads, runs, and unloads the entire CGI. CGI 
programs are independent from the Web server and cannot write to the Web server's 
logs or find out about the capabilities of the server. Additionally, CGI pages are often 
not readily portable to other platforms. 
Since the implementation of CGI programs, several vendors have created unique 
approaches to working around its inherent limitations. FastCGI, created by Open 
Market, is a CGI alternative that creates a single persistent process for each CGI 
request. While this helps, there is still one process for each CGI program, and further 
resources are consumed if that process needs to launch an interpreter such as Perl. To 
find out more about FastCGI visit the Fast Engine Web site at: 
http://www.fastengines.com/

Another method of increasing CGI performance was embedding an interpreter into the 
Web server. This allows the Web server to precompile and prefork the CGI. It also 
allows for native API hooks into the Web server. The largest limitation associated 
with these approaches is that they are tied to a very specific language, platform, and 
Web server. Some examples of this include mod_perl for the Apache Web server and 
PerlEx by ActiveState for the Microsoft Internet Information Server. To get more 


information on mod_perl go to the Perl/Apache Web site at: 
http://perl.apache.org/

Find out more about PerlEx by visiting Active State's Web site at: 
http://www.activestate.com/plex/

While all of these attempts to overcome the limitations of CGI programs have 
improved their performance, the limitations of the CGI process itself is responsible for 
most of the system's drawbacks. 

tải về 2.32 Mb.

Chia sẻ với bạn bè của bạn:
1   2   3   4   5   6   7   8   9   ...   16




Cơ sở dữ liệu được bảo vệ bởi bản quyền ©tieuluan.info 2022
được sử dụng cho việc quản lý

    Quê hương