Comparison between JSP and ASP and PHP

Source: Internet
Author: User
Comparison with ASP and PHP:
Currently, the three most common dynamic web page languages are Asp (Active Server Pages), JSP (Java Server PGES), and PHP (Hypertext Preprocessor ).
ASP full name Active Server Pages is a web server development environment that can be used to generate and run dynamic, interactive, and high-performance Web service applications. Program . ASP uses the scripting language VB script (Java Script) as its own development language.
PHP is a cross-platform server-side embedded scripting language. it borrowed a lot of C, Java, and Perl syntaxes and coupled with PHP's own features, enabling web developers to quickly write dynamic pages. it supports most databases currently. Another point is that PHP is completely free and free to spend, and you can download it freely from the official site of PHP (http://www.php.net. In addition, you can obtain the source code without restrictions, and even add the features you need.
JSP is a new generation of site development language released by Sun. It completely solves a common problem of ASP and PHP-script-level execution (it is said that PhP4 is also supported by Zend, compile and run the program ). with its extraordinary accomplishments in Java, Sun has made a new achievement in Java applications and Java applets, namely JSP-Java Server Page. JSP supports powerful site programs with the support of serverlet and JavaBean.
All three are provided in HTML Code The ability to mix some program code and interpret and execute the program code by the Language engine. However, JSP code is compiled into a Servlet and interpreted and executed by the Java Virtual Machine. This compilation operation only occurs during the first request to the JSP page. In ASP, PHP, and JSP environments, HTML code describes the display style of information, while program code describes the processing logic. Common HTML pages only depend on Web servers, while ASP, PHP, and JSP pages require additional language engines to analyze and execute program code. The execution result of the program code is re-embedded into the HTML code and sent to the browser together. ASP, PHP, and JSP are all web server-oriented technologies. Client browsers do not require any additional software support.
JSP vs ASP
JSP is cross-platform and supports all mainstream Web servers, including Apache, Netscape, IIS, and ibm http server (with a market share of more than 85% ), ASP currently only supports nt + IIS (with a market share of about 20%). It provides a better security mechanism, which is crucial for applications such as e-business; JSP can be used across operating systems, Web servers, and application servers, whereas ASP is limited to NT + IIS;
JSP is an open standard and is supported by Oracle, Netscape, IBM & WebLogic, and Inprise. jsp components are easier to write, and JSP performance is caused by ASP;
JSP vs PHP
JSP is an industry standard and supported by Sun, IBM, Oracle, Bea, Apache, etc. php is only a free ware with a poor development organization. php has poor performance, it is interpreted. jsp is equivalent to C after JIT compilation and supports multithreading. jsp supports many platforms, from Win98, NT, UNIX, Linux, FreeBSD to AS/400, OS/390, while PHP supports a limited platform; jsp can connect to many mainstream relational databases using JDBC, while PhP currently only supports a limited number of MySQL and Oracle; JSP components, it is very easy to develop JavaBean and EJB, and all Java classes and functions can be used in JSP. PHP can only use C to write components with limited functions, and the compilation is complicated. jsp can support EJB to support transaction and CORBA standards, and LDAP, message, and other services, this makes it easy to access enterprise applications such as ERP, CICs, and MQ. PHP is inherently inadequate in this respect, so PHP is not suitable for mission-critical applications such as e-commerce.
Performance Comparison
Some people have performed tests to test the cyclic performance of these three languages and to access the Oracle database. In the cyclic performance test, JSP ended the 20000*20000 loop in just four surprising seconds. ASP and PHP test 2000*2000 cycles (one order of magnitude less), but they use 63 s and 84 s respectively.
In the database test, it takes 13 seconds for Oracle 8 to perform 1000 insert, update, select, and delete: JSP, 69 seconds for PHP, and 73 seconds for ASP.
Foreground Analysis
PHP and ASP are widely used in China. JSP is a relatively new technology, which is rarely used in China. However, in foreign countries, JSP is already a popular technology, especially for e-commerce websites, mostly using JSP.
Websites using PHP, such as Sina and chinaren, are not suitable for large-scale e-commerce sites due to some shortcomings of PHP, it is more suitable for some small commercial sites.
First, PHP lacks support for scale. Second, the lack of multi-layer structure support. For heavy-load sites, there is only one solution: distributed computing. The database and application logic layers are separated from each other, and the same layer can also be separated by traffic to form a two-dimensional array. PHP lacks such support. As mentioned above, the database interfaces supported by PHP are not uniform, which makes it unsuitable for e-commerce.
ASP and JSP have no such defects. asp can obtain ActiveX scale support through Microsoft windowsd COM/DCOM, and obtain structure support through DCOM and transcation server; JSP can be scaled through Sun Java's Java class and EJB, and structural support can be obtained through EJB/CORBA and Application Server of many vendors.
Among the three, JSP should be the future development trend. Some big E-commerce solution providers in the world use JSP/servlet. IBM e-business is famous for its core, WebSphere with JSP/servlet, and intershop, another famous Western e-commerce software provider. Its original products intershop1 2, 3, and 4 occupy the main share of e-commerce software. They are all supported through CGI. However, after last October, it launched enfinity, an e-commerce application server that uses JSP/servlet, and does not develop traditional software.
JSP application scope:
Like PHP, jsp can run on almost all platforms. For example, in Windows NT, Linux, and Unix. nt, IIS supports JSP through a plug-in, such as JRun or ServletExec. The famous web server Apache already supports JSP. Because Apache is widely used in NT, UNIX, and Linux, JSP has a wider operating platform. Although the NT operating system has a large market share, the Unix advantage in the server is still great, and the new Linux is not small. Porting from one platform to another, JSP and JavaBean do not even need to be re-compiled, Because Java bytecode is standard and platform independent.
Other related technologies
JDBC
JDBC (Java database connectivity) is an interface for Java applications to access relational databases. It can be a cross-platform language, and the above applications (pure Java) can run on any operating system or application server, such as: as the number of users and visits increases, you may consider switching to commercial Unix servers and commercial application servers. Applications Based on Java solutions can be smoothly transplanted to new systems without any changes, to maximize the protection of existing investment;
With the support of EJB (Enterprise JavaBeans), you can achieve a distributed computing environment based on components and load balancing;
Various vendors provide many efficient development tools, such as IBM WebSphere Studio and some java IDE. Considering the performance impact, we recommend that Oracle server and web server adopt a distributed structure.
JavaBeans
JavaBeans is a reusable Java component that can be called by Java applications such as applet, Servlet, and JSP, or visually used by Java development tools. It includes properties, methods, and events.
Servlet
Servlet is a Java application running on the server. It can be embedded into the web server as a plug-in, provides customized protocol services such as HTTP and FTP. If you have used Java Servlet, you will know that servlet allows you to build a dynamic web page, which contains data obtained from the server's Java object. However, you also need to know that the servlet method for generating web pages is to embed HTML tags and express code in Java classes. This means that you need to modify and recompile the Servlet Source file to change the expression code. Because the designers who design HTML pages may not be the same person as the developers who write servlet code, updating servlet-based Web applications becomes very tricky.
Enter assumerver page is an extension of servlet API. In fact, JSP web pages can be used before being compiled into servlet, so they also have all the advantages of servlet, including accessing Java APIs. JSP is embedded into the servlet for the general expression of the application code, so they can be seen as a "thorough" servlet.
JSP web pages mainly provide a high-level method to establish servlet, which also brings other advantages. Even if you have compiled servlets for Web applications, using JSP still has many advantages:
JSP web pages can be easily combined with static templates, including HTML or XML fragments and code that generates dynamic content.
JSP web pages can be dynamically compiled into servlet upon request, so web page designers can easily update the expression code. If necessary, the JSP page can also be pre-compiled.
To call JavaBean components, JSP labels can fully manage these components to prevent web designers from complicate applications.
Developers can provide customized JSP tag libraries.
Webpage designers can change and edit the fixed template part of the webpage without affecting the application. Similarly, developers do not need to edit pages one by one, but only need to make reasonable changes to components.
Generally, JSP allows developers to distribute functional applications to many web designers. These designers do not need to know the Java Programming Language Or any servlet code, so they can focus on writing HTML code, and programmers can focus on building objects and applications.
Related Article

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: info-contact@alibabacloud.com 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.