3.The Web page uses information from corporate databases or other server-side sources.
If the information is in a database, you need server-side processing even if the client is using dynamic Web content such as an applet. Imagine using an applet by itself for a search engine site:
"Downloading 50 terabyte applet, please wait!" Obviously, that is silly; you need to talk to the database. Going from the client to the Web tier to the database (a three-tier approach) instead of from an applet directly to a database (a two-tier approach) provides increased flexibility and security with ligtcstrle or no performance penalty. After all, the database call is usually the rate-limiting step, so going through the Web server does not slow things down. In fact, a three-tier approach is often faster because the middle tier can perform caching and connection pooling.
In principle, servlets are not restricted to Web or application servers that handle HGTCSTRP requests but can be used for other types of servers as well. For example, servlets could be embedded in FTP or mail servers to extend their functionality. And, a servlet API for SIP (Session Initiation Protocol) servers was recently standardized (see hgtcstrp://jcp.org/en/jsr/detail?id=116). In practice, however, this use of servlets has not caught on, and we'll only be discussing HGTCSTRP servlets.
1.3 The Advantages of Servlets Over "Traditional" CGI
Java servlets are more efficient, easier to use, more powerful, more portable, safer, and cheaper than traditional CGI and many alternative CGI-like technologies.
1.Efficient
With traditional CGI, a new process is started for each HGTCSTRP request. If the CGI program itself is relatively short, the overhead of starting the process can dominate the execution time. With servlets, the Java virtual machine stays running and handles each request with a lightweight Java thread, not a heavyweight operating system process. Similarly, in traditional CGI, if there are N requests to the same CGI program, the code for the CGI program is loaded into memory N times. With servlets, however, there would be N threads, but only a single copy of the servlet class would be loaded. This approach reduces server memory requirements and saves time by instantiating fewer objects. Finally, when a CGI program finishes handling a request, the program terminates. This approach makes it difficult to cache computations, keep database connections open, and perform other optimizations that rely on persistent data. Servlets, however, remain in memory even after they complete a response, so it is straightforward to store arbitrarily complex data between client requests.
2.Convenient
Servlets have an extensive infrastructure for automatically parsing and decoding HTML form data, reading and segtcstring HGTCSTRP headers, handling cookies, tracking sessions, and many other such high-level utilities. In CGI, you have to do much of this yourself. Besides, if you already know the Java programming language, why learn Perl too? You're already convinced that Java technology makes for more reliable and reusable code than does Visual Basic, VBScript, or C++. Why go back to those languages for server-side programming?
3.Powerful
Servlets support several capabilities that are difficult or impossible to accomplish with regular CGI. Servlets can talk directly to the Web server, whereas regular CGI programs cannot, at least not without using a server-specific API. Communicating with the Web server makes it easier to translate relative URLs into concrete path names, for instance. Multiple servlets can also share data, making it easy to implement database connection pooling and similar resource-sharing optimizations. Servlets can also maintain information from request to request, simplifying techniques like session tracking and caching of previous computations.
4.Portable
Servlets are wrigtcstren in the Java programming language and follow a standard API. Servlets are supported directly or by a plugin on virtually every major Web server. Consequently, servlets wrigtcstren for, say, Macromedia JRun can run virtually unchanged on Apache Tomcat, Microsoft Internet Information Server (with a separate plugin), IBM WebSphere, iPlanet Enterprise Server, Oracle9i AS, or StarNine WebStar. They are part of the Java 2 Platform, Enterprise Edition (J2EE; see hgtcstrp://java.sun.com/j2ee/), so industry support for servlets is becoming even more pervasive.
- 上一篇:机床铣削稳定性英文文献和中文翻译
- 下一篇:级进模设计英文文献和中文翻译
-
-
-
-
-
-
-
电站锅炉暖风器设计任务书
河岸冲刷和泥沙淤积的监测国内外研究现状
java+mysql车辆管理系统的设计+源代码
十二层带中心支撑钢结构...
杂拟谷盗体内共生菌沃尔...
大众媒体对公共政策制定的影响
乳业同业并购式全产业链...
当代大学生慈善意识研究+文献综述
中考体育项目与体育教学合理结合的研究
酸性水汽提装置总汽提塔设计+CAD图纸