This article will introduce the differences and respective functions of ASP, PHP, and JSP.
Recommended courses: PHP Tutorial.
ASPThe full name is ActiveServerPages, which is a WEB server-side development environment that can be used to generate and execute dynamic, interactive, high-performance WEB service application. ASP uses the scripting language VBScript (Javascript) as its own development language.
PHP is a cross-platform server-side embedded scripting language. It borrows a lot of syntax from C, Java and Perl languages, and couples PHP's own features to enable WEB developers to quickly write dynamically generated pages. It supports most current databases. Another point is that PHP is completely free. You don’t need to spend money. You can download it freely from the PHP official site (http://www.php.net). And you have unrestricted access to the source code, and you can even add the features you need.
JSP is a new generation website development language launched by Sun Company. Sun Company relies on its extraordinary achievements in Java to make Java other than Java applications and JavaApplets, and has new achievements, that is JSP, JavaServerPage. JSP can complete powerful site programs with the support of Serverlet and JavaBean.
All three provide the ability to mix certain program code in HTML code and have the language engine interpret and execute the program code. However, the JSP code is compiled into a Servlet and interpreted and executed by the Java virtual machine. This compilation operation only occurs on the first request for the JSP page. In ASP, PHP, and JSP environments, HTML code is mainly responsible for describing the display style of information, while program code is used to describe processing logic. Ordinary HTML pages only rely on the Web server, while ASP, PHP, and JSP pages require additional language engines to analyze and execute program code. The execution results of the program code are re-embedded into the HTML code and then sent to the browser together. ASP, PHP, and JSP are all Web server-oriented technologies, and the client browser does not require any additional software support.
Technical Features
ASP:
1. Use VBScript, JScript and other simple and easy-to-understand scripting languages, combined with HTML code, to quickly complete the website application.
2. No need to compile, easy to write, and can be executed directly on the server side.
3. Use an ordinary text editor, such as Windows Notepad, to edit and design.
4. BrowserIndependence (BrowserIndependence), the client can browse the web content designed by ActiveServerPages as long as it uses a browser that can execute HTML code. The script languages (VBScript, Jscript) used by ActiveServerPages are executed on the WEB server, and the client's browser does not need to be able to execute these script languages.
5.ActiveServerPages is compatible with any ActiveXscripting language. In addition to using VBScript or JScript language to design, you can also use other scripting languages provided by third parties through plug-in, such as REXX, Perl, Tcl, etc. The script engine is a COM (ComponentObjectModel) object that handles script programs.
6. Server-side scripts can be used to generate client-side scripts.
7.ActiveXServerComponents (ActiveX server components) have unlimited scalability. You can use VisualBasic, Java, VisualC++, COBOL and other programming languages to write the ActiveXServerComponent you need.
PHP:
1 Database connection
PHP can be compiled with functions that connect to many databases. PHP and MySQL are an excellent combination right now. You can also write your own peripheral functions to access the database indirectly. In this way, when you change the database you use, you can easily modify the coding to adapt to such changes. PHPLIB is the most commonly used series of base libraries that can provide general transaction needs. However, the database interface support provided by PHP is not unified with each other. For example, the interfaces to Oracle, MySQL, and Sybase are different from each other. This is also a weakness of PHP.
JSP:
1. Separate content generation and display
Using JSP technology, Web page developers can use HTML or XML tags to design and format the final page. Use JSP tags or scripts to generate dynamic content on the page. The logic for generating content is encapsulated in the logo and JavaBeans group components and bundled in small scripts. All scripts are executed on the server side. If the core logic is encapsulated in tags and beans, others, such as Web managers and page designers, can edit and use JSP pages without affecting content generation. On the server side, the JSP engine interprets the JSP tags, generates the requested content (for example, by accessing JavaBeans group components, using JDBC technology to access the database), and sends the results back to the browser in the form of an HTML (or XML) page . This helps authors protect their code while ensuring full usability with any HTML-based web browser.
2. Emphasis on reusable group components
Most JSP pages rely on reusable and cross-platform components (such as JavaBeans or EnterpriseJavaBeans) to perform more complex tasks required by the application. deal with. Developers can share and exchange components that perform common operations or make these components available to a larger number of users or groups of users. The component-based approach accelerates the overall development process and allows various groups of organizations to leverage their existing skills and development efforts to optimize results.
3. Use logos to simplify page development
Web page developers will not all be programmers familiar with scripting languages. JavaServerPage technology encapsulates many of the features needed for dynamic content generation in easy-to-use, JSP-related XML tags. Standard JSP tags can access and instantiate JavaBeans components, set or retrieve group component properties, download applets, and perform functions that are more difficult and time-consuming to code using other methods.
JSP technology is extensible by developing customized logo libraries. In the future, third-party developers and others can build their own libraries of tags for commonly used functions. This allows Web page developers to work with familiar tools and components like markup that perform specific functions.
JSP technology can be easily integrated into a variety of application architectures to leverage existing tools and techniques, and can be expanded to support enterprise-level distributed applications. As part of the Java technology family, and a member of Java2EE, JSP technology can support highly complex Web-based applications.
Because the built-in scripting language of JSP pages is based on the Java programming language, and all JSP pages are compiled into JavaServlets, JSP pages have all the benefits of Java technology, including robust storage management and security.
As part of the Java platform, JSP has the characteristics of "write once, execute everywhere" of the Java programming language. As more and more vendors add JSP support to their products, you can use the server and tools of your choice, and modifying the tools or servers does not affect your current applications.
Application Scope
ASP is a dynamic web page language developed by Microsoft. It also inherits the tradition of Microsoft products and can only be executed on Microsoft's server products, IIS (Internet Information Server) (windows NT) and PWS (Personal Web Server). (windows98). There are also ChiliSoft components under Unix to support ASP, but the functions of ASP itself are limited and must be expanded through the combination of ASP + COM. It is very difficult to implement COM under Unix.
PHP3 can be executed normally on Windows, Unix, and Linux web servers. It also supports general web servers such as IIS and Apache. When users change platforms, there is no need to change the PHP3 code and it can be used immediately.
JSP is similar to PHP3 and can be executed on almost all platforms. Such as WinNT, Linux, Unix. Under NT, IIS can support JSP through an external server, such as JRUN or ServletExec. The well-known web server Apache already supports JSP. Since Apache is widely used on NT, Unix and Linux, JSP has a wider range of execution platforms. Although the NT operating system now accounts for a large market share, Unix still has a great advantage in servers, and the newly emerging Linux is even more powerful. When ported from one platform to another, JSP and JavaBeans don't even need to be recompiled, because Java bytecodes are standard and platform-independent.
Performance Comparison
Some people have done experiments to conduct loop performance tests and Oracle database access tests for these three languages.
In the loop performance test, JSP only took an astonishing four seconds to end the 20000*20000 loop. However, ASP and PHP tested 2000*2000 cycles (an order of magnitude less), but took 63 seconds and 84 seconds respectively. (Refer to PHPLIB).
In the database test, the three performed 1,000 Insert, Update, Select and Delete on Oracle8 respectively: JSP took 13 seconds, PHP took 69 seconds, and ASP took 73 seconds.
Prospect Analysis
Currently PHP and ASP are the most widely used in China. Since JSP is a relatively new technology, it is rarely used in China. But in foreign countries, JSP is already a relatively popular technology, especially e-commerce websites, which mostly use JSP.
Websites that use PHP such as Sina (sina), Chinaren (Chinaren), etc., but due to some shortcomings of PHP itself, it is not suitable for large-scale e-commerce sites, but is more suitable for some small commercial sites. First, PHP lacks scale support. Secondly, there is a lack of multi-layer structural support. For heavy-load sites, there is only one solution: distributed computing. The database, application logic layer, and presentation logic layer are separated from each other, and the same layer can also be separated according to traffic and grouped into a two-dimensional array. PHP lacks this support. As mentioned above, the database interface support provided by PHP is not uniform, which makes it unsuitable for use in e-commerce.
ASP and JSP do not have the above defects. ASP can obtain ActiveX scale support through COM/DCOM of Microsoft Windowsd and structure support through DCOM and TranscationServer; JSP can obtain scale support through SUNJava's JavaClass and EJB, and can obtain scale support through EJB/CORBA and many other The vendor's ApplicationServer receives fabric support.
Among the three, JSP should be the future development trend. Some of the world's largest e-commerce solution providers use JSP/Servlet. The more famous ones are IBM's E-business, whose core is WebSphere using JSP/Servlet. They are all powered by CGI. But after October last year, it launched Enfinity, an e-commerce Application Server using JSP/Servlet, and stated that it would no longer develop traditional software.
In short, ASP, PHP, and JSP all have a considerable number of supporters, and it can be seen that each of the three has its own strengths. Friends who are learning or using dynamic pages can choose a language that suits them based on the characteristics of the three.
The above is the detailed content of The difference between jsp, asp and php. For more information, please follow other related articles on the PHP Chinese website!