Comparison between ASP, PHP, JSP, and ASP. NET

Source: Internet
Author: User
Tags echo date php introduction what php ad server web hosting what is asp brinkster microsoft website

ASP, PHP, JSP, and ASP. NET are currently the four most popular WEB website programming languages. Currently, most websites use one of these languages.

ASP is based on the WINDOWS platform and is easy to use. Because it runs on the WINDOWS platform, it has poor portability and cannot run across platforms. However, most websites in China use it for development now.

PHP is a highly-respected WEB programming language. It is open-source and cross-platform. It is popular in Europe and America. It has recently become popular among many website developers in China. high development efficiency and low cost!

JSP is a network programming language released by SUN, which is hard to learn (recognized on the Internet) and runs across platforms. high Security and fast operation efficiency. it is widely used by enterprise-level companies and banking and financial institutions.

ASP. in a sense, it should be an ASP version upgrade, but it is not completely upgraded from ASP. NET is launched by Microsoft to work with SUN's JSP on the network
The. NET architecture is currently being learned by many people, mainly because the development efficiency is relatively high. However, it is still based on the WIN platform and cannot be used across platforms.

ASP Introduction
ASP is called Active Server Pages in English.

ASP is a dynamic web page with the file suffix. asp.

An ASP Webpage is an HTML webpage containing a server-side script. The Web server processes these scripts, converts them to HTML format, and then uploads them to the client's browser.

The following figure shows the differences between HTML and ASP.

Differences between HTML and ASP
HTML is the simplest language for compiling web pages. HTML can only be used to compile static webpages.

When a user browser (as shown in: Web Client) requests an HTML
When a webpage is accessed, the Web server directly sends the webpage to the user's browser without computation. The browser then processes the HTML code of the webpage and displays the result.


The processing process of ASP is more complex. When a user's browser (as shown in: Web Client) moves from the Web Server (as shown in: Web Server)
When an ASP Webpage is required, the Web server sends the ASP file to the ASP Engine (ASP Engine) and ASP
The engine converts all the server scripts (as shown in <% and %>) on the ASP Web page into HTML code, and then converts all HTML
The code is sent to the user's browser.


What can ASP do?
The most suitable scripting language for Web pages. VBScript.

HTML and CSS can be used to write beautiful static webpages, but these webpages lack interaction with users.

For example, you need to add the user registration and login functions for your website. You may also need to perform some online surveys to learn about users' feedback on an event or product; you may also need an e-commerce website to release product information in a timely manner and satisfy users' online ordering needs ......

And ASP. HTML code, and then display the result. Full name in English!

Compiling ASP dynamic web pages can help you implement these user interaction functions.

A simple ASP example


<Title> ASP code: ASP output syntax </title>



<P> <% = "www. blabla. cn" %> </p>



Timely release product information and meet users' online ordering needs ..?


Is a dynamic web page with the file suffix. asp?

In the above ASP Web Page code example, you can see that this ASP file is basically the same as a common HTML web page, in addition to the Code <% = "" %>.

<%> Indicates that the code in is ASP code.

<% = Indicates the result of ASP code output.

PHP Introduction

If you are engaged in Web-based development, you may have heard of PHP. You may not know exactly what PHP is, how it works, or why it is so popular, but it is time to learn more about PHP. This article briefly introduces the basic concepts of PHP.

Background Knowledge
PHP is a small open source code. As more and more people become aware of its practicality, it gradually develops. Rasmus Lerdorf released the first PHP version in 1994. Since then, it has developed rapidly and has been improved and improved to version 4.0.3 through numerous improvements.

PHP is embedded in HTML
The script language interpreted by the server. It can be used to manage dynamic content, support databases, process session tracking, and even build the entire e-commerce site. It supports many popular databases, including
MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.

Dynamic and Static content
Why is dynamic content so popular? Assume that you are managing e-commerce sites with 10 products. As long as the product does not change frequently or is not expected to change much
Static product pages with necessary information, forms, and such content are not difficult. However, if you want to add another 10
Or more products, and then more in the next month, and the price sometimes changes or wants to change the site view. Then you will be in the predicament of manually writing dozens of pages, maybe hundreds of static pages.

On the other hand, assume that you create product. php from
Page. It does not have static information. Instead, it can be encoded to extract information from the product database and dynamically build a page. Then you have a metadata page, which can be based on the information stored in the database
Provides one, one hundred, or even 100,000 separate pages. Now, the website administrator no longer simply updates static pages all day, because the information in the company database can be updated at the same time.
. This eliminates the headache of time delay (the interval between changing information in the database and displaying information on the website ).

In general, PHP is very suitable for Web work. But it is not the only method; for example
Perl, Java, JavaScript, ASP, Python, Tcl, CGI, and many other methods can generate dynamic content. However, PHP
It is designed for Web-based problems and open source code.

If you are looking for programming languages for text processing or 3D games, PHP may not be the language you need. If you need to run a website with dynamic content, database interaction, and e-commerce, continue reading, because PHP is indeed very useful in this regard.

Applicable PHP platform
Most common PHP installations are usually PHP that runs together with Linux or Apache on a variety of UNIX
Module. But don't worry if you are using another platform. PHP can run on Windows NT, 9x, and many other Web servers. You can introduce
Some websites in the Apache/Linux/PHP combination find more documents about PHP, but it is not the only platform supporting PHP.

License and use
How much does it cost to purchase an embedded Web scripting language with all functions? Don't spend a penny? PHP
Is an open source project, so there is no license fee or restrictions on use. You can use PHP
To run small, non-profit sites, or to run a billion dollar e-commerce website, and the cost is the same: zero. If you want to modify PHP, you can modify it.

PHP does not get the GPL license, but its own license allows redistribution of code and/or binary files.

Now you are sure you want to try PHP. Let's take a look at some simple examples to give you a rough idea of PHP. Remember, this is not a way to gain an in-depth understanding of PHP, but just a quick start.

"Hello, World! "
To understand PHP, let's take a look at several very simple PHP scripts. Since "Hello, World! "Is a common example. Let's write a friendly little" Hello, World! "Script.

As mentioned earlier, PHP is embedded in HTML. (Maybe your file barely contains HTML, but this file is usually a mixture of PHP and HTML .) This means that in your normal HTML (or XHTML, if you are at the forefront), there will be PHP statements like this:

<Body bgcolor = "white">

<Strong> How to say "Hello, World! "</Strong>
<? Php echo "Hello, World! ";?>
Simple, huh?

It's easy, isn't it? This is just an "echo"
Statement. Of course, this alone is of little use. But it does tell us something about language. (By the way, if you check the HTML output, you will notice that PHP
The Code does not appear in the file sent from the slave server to your Web browser. All PHP on the Web page will be processed and stripped from the page;
The server returns only HTML output to the client .)

Print the date and time on the Web page
Now let's do something practical. This example prints the date and time on the Web page.

<Body bgcolor = "white">
<Strong> An Example of PHP in Action </strong>
<? Php echo "The Current Date and Time is: <br> ";
Echo date ("g: I A l, F j Y.");?>
// G = the hour, in 12-hour format
// I = minutes
// A = print AM or PM, depending...
// L = print the day of the week
// F = print the month
// J = print the day of the month
// Y = print the year-all four digits

This code generates the following output:

The Current Date and Time is:
11: 00 AM Friday, October 20 2000.

Note that PHP and HTML are mixed here. If you already know HTML, only the PHP code is explained here. You can find the complete PHP reference on (see references.

PHP code is to mark <? Php starts and starts with?> End. This tells the server to <? Php and?> All content
PHP commands perform syntax analysis. If you find them, you need to execute them. Please note that when processing and serving your files, the customer will receive common HTML
File. Those browsing your site cannot see any PHP Command. Unless you make a mistake, the server splits the PHP code and does not process it first.

In general? Php and?> Between regular HTML tags. Note that the preceding simple script contains the <br> branch tag. If the HTML format cannot be used well, PHP will not be very useful.

If you want to use it with other things, or you are a forgetful person like me, you may want to comment out the code. // The character indicates that it is a comment and the server will not process it //
The marked content will not pass the content to the client like the comments in HTML. If <? Php and?> There is a standard between tags <! --
Comment -->
When the server performs syntax analysis on it, errors may occur. Obviously, you may not comment on your code like I do with this basic function, but it is a good example.

Note that every PHP function is enclosed in parentheses and ended with a semicolon.
Similar. It is common to omit an ending parentheses or semicolons due to a simple printing error, so make sure to check the code. Such as Vim or Emacs
Compiling PHP in such an Editor (which can highlight the syntax) helps to eliminate such errors. It allows you to capture errors immediately.

The date function is only one of the built-in PHP functions. PHP comes with many features that can be used to connect to databases, create PDF, Shockwave, JPG, GIF, and PNG
And other image files, send emails, read and write files, syntax analysis XML, session processing, direct conversations with browsers over HTTP, and many other features.

PHP also allows users to define their own functions. This enables the PHP language to access the Web
Provides a large number of solutions. Instead of writing everything from the very beginning. Before writing a function, make sure that you have checked such as and PHP Wizard.
Freshmeat to check whether there are functions you are writing (see references ).

Many open-source PHP
Solution. It is meaningless to start from scratch. Instead, you should start with the built foundation and customize it to your own solution. If you only have a preliminary understanding and learning
PHP has no specific projects in mind, so these projects are still good examples and learning materials for using PHP.

JSP Introduction

Jsp is a dynamic web page Technical Standard promoted by Sun Microsystems and jointly established by many companies. Its website is This technology provides a simple and fast way to create a Web page that displays dynamically generated content. JSP technology is designed to make it easier and faster to Construct Web-based applications that work with various Web servers, application servers, browsers, and development tools. JSP specifications are Web servers, application servers, and transaction systems
Result of extensive cooperation among development tool suppliers. Add Java program snippets (Scriptlet) and JSP labels to traditional webpage Html files (* htm, *. html)
Tag forms a JSP webpage (*. jsp ). When the Web server encounters a request to access the JSP webpage, it first executes the program fragment and then returns the execution result in HTML format.
Return to the customer. Program snippets can operate databases, redirect webpages, and send emails
And so on. This is the function required to build a dynamic website. All program operations are performed on the server, and the results are only obtained after the network is uploaded to the client. The client has the lowest requirements on the client browser and can achieve zero
Plugin, no ActiveX, no Java Applet, or even no Frame.

JSP Technology accelerates the development of dynamic web pages in multiple aspects:
First. Separate content generation and display
With JSP technology, Web page developers can use HTML or XML tags to design and format the final page. Generate dynamic content (Content
Is changed according to the request, such as requesting account information or the price of a specific bottle of wine ). The logic of the generated content is encapsulated in the identifiers and JavaBeans components, and bundled in small scripts.
Run on the server. If the core worker
When tags and Beans are encapsulated, other people, such as Web administrators and page designers, can edit and use JSP pages without affecting content generation. On the server side, JSP Engine explanation
JSP identifiers and small scripts to generate the requested content (for example, access the database by accessing the JavaBeans component, using JDBCTM technology, or including files), and
HTML (or XML) pages are sent back to the browser. This helps the author protect his own code and ensure the full availability of any HTML-based Web browser.

Second. reusable components
Most JSP pages depend on reusable, cross-platform components (JavaBeans or Enterprise
Javanstm component) to execute the more complex processing required by the application. Developers can share and exchange components that perform common operations, or make these components more user or customer
Used by user groups. The Component-Based Approach accelerates the overall development process and balances various organizations in their development efforts with their existing skills and optimization results.

Third. Simplified page development with logo
Web page developers are not all programmers familiar with the scripting language. Assumerver
The Page technology encapsulates many functions that are required for dynamic content generation in easy-to-use and JSP-related XML identifiers. Standard JSP identity can be accessed and instantiated
The JavaBeans component sets or retrieves component attributes, downloads the Applet, and executes functions that are more difficult to encode and consume in other ways.
Through the development of a custom identification library, JSP technology can be expanded. In the future, third-party developers and others can create their own identification libraries for common functions. This allows Web page developers to work with familiar tools and components that execute specific functions like identifiers.
JSP technology can easily be integrated into a variety of application architectures to take advantage of existing tools and techniques and extend to support enterprise-level distributed applications. As part of the Java technology family and an integral part of Java 2 (Enterprise Edition architecture), JSP technology can support highly complex Web-based applications.
The built-in scripting language for JSP pages is based on the Java programming language, and all JSP pages are compiled into Java
Servlet and JSP pages have all the advantages of Java technology, including robust storage management and security. As part of the Java platform, JSP has the Java programming language
Write, run everywhere "features. As more and more vendors add JSP support to their products, you can use the servers and tools you select. Changing tools or servers does not affect the current
. When working with Java 2 platform, Enterprise Edition (J2EE) and Enterprise
When the JavaBean technology is integrated, JSP pages provide enterprise-level scalability and performance, which is necessary for deploying Web-based applications in Virtual Enterprises.
Fourth. Technical Analysis
Microsoft's ASP technology is also a dynamic web page development technology. JSP and ASP are very similar in form. ASP programmers can recognize <%> and <% = %> at a glance. However, further exploration will reveal many differences, including the following three main points:
1. JSP is more efficient and secure
ASP is stored as the source code and run as an interpreter. The Source Code must be interpreted for each ASP Web page call, which is inefficient. In addition, the IIS vulnerability has exposed many website source programs.
Including my previous websites developed with ASP, all ASP programs were downloaded. JSP is compiled into bytecode (byte
By Java Virtual Machine (Java Virtual
Machine) implements interpretation, which is more efficient than source code interpretation. The server also has a bytecode Cache mechanism, which can improve the access efficiency of bytecode. The first time a JSP page is called, it may be a little slow because it is
Compile it into a Cache, and it will be much faster in the future. At the same time, JSP Source programs are unlikely to be downloaded, especially the JavaBean program can be placed in a non-External directory.
2. More convenient JSP components (Component)
ASP expands complex functions through COM, such as file uploading, sending emails, and separating business processing or complex computing into independent Reusable Modules. JSP
JavaBean implements the same function expansion. In terms of development, the development of COM is far more complex and complex than that of JavaBean. Learning ASP is not difficult, but learning to develop COM is not easy. While
JavaBean is much simpler. From the above examples, we can see that it is very convenient to develop JavaBean. In terms of maintenance, COM must be registered on the server. If the COM program is modified
Must be re-registered, or even shut down and restarted. JavaBean does not need to be registered and can be placed in the directory contained in CLASSPATH. If the JavaBean is modified
JSWDK and Tomcat still need to be shut down and re-run (but not shut down), but developers have promised not to shut down the server in future versions. In addition, JavaBean is completely
OOP allows you to easily create a set of reusable object libraries for different service processing functions, such as user permission control and automatic email reply.
3. A Wider JSP adaptation platform
ASP currently only applies to NT and IIS. Although there are ChiliSoft plug-ins in Unix to support ASP, ASP itself has limited functions and must be expanded through the combination of ASP + COM. It is very difficult to implement COM in Unix.

1.1 What is is a general language-based program architecture that can be used by a Web server to build powerful Web applications. provides many advantages over the current Web development model.

Significant improvement in execution efficiency runs a general-language-based program on the server. Unlike the previous ASP instant interpreter program, the program is compiled at the first run of the server. This execution effect is certainly much better than one interpretation.

World-class tool support
The architecture can be developed using Microsoft (R)'s latest product Visual development environment.
You See Is What You Get. These are only a small part of the support for powerful software.

Robustness and adaptability

Because is a program compiled and run based on a general language, its strength and adaptability can make it run on almost all the platforms of Web application software developers (I have
Only known that it can only be used in Windows 2000
Server ). The basic library, messaging mechanism, and data interface processing of common languages can be seamlessly integrated into Web applications. is also
Language-independent language is independent. Therefore, you can select a language that best suits you to compile your program, or write your program in many languages.
C # (a combination of C ++ and Java), VB, and Jscript are supported. In the future, the ability to work collaboratively in multiple programming languages will protect your current programs developed based on COM +.

Simplicity and learning is very simple to run some common tasks such as form submission client authentication, distribution system and website configuration. For example, the page architecture allows you to create your own user interface, so that it is different from the common VB-Like interface. In addition, the simplified development of common languages makes it easy to combine code into software, just like assembling a computer.

Efficient manageability uses a character-based and hierarchical configuration system to simplify the configuration of your server environment and applications. Because the configuration information is stored in simple text, new settings may not
You can enable the local administrator tool. This is called "Zero Local
The philosophy of Administration makes application-based development of more specific and fast. The installation of an application on a server system only requires
To simply copy some required files without restarting the system, everything is so simple.

Multi-processor Environment Reliability has been deliberately designed as a development tool for multi-processor. It uses special seamless connection technology in a multi-processor environment, which will greatly improve the running speed. Even if your current
The application is developed for a processor. In the future, the performance of multiple processors can be improved without any changes, but the current ASP does not.

Customization and scalability

In design, website developers can define their own "plug-in" modules in their own code. This is different from the original inclusion relationship. can add components defined by itself. The development of website programs has never been so simple.


Based on the Windows Authentication Technology and the configuration of each application, you can ensure that your original application is absolutely safe. (However, the Asp experience tells us that we cannot be so confident that M $ always has bugs)

1.2 Main content of this tutorial syntax

The syntax of may be familiar to the old ASP programmers, but there are also some new things. The Quick Start tutorial will talk about them in detail.

Structure and features of

Introducing all the features of, ASP developers can write world-class interactive application software, with less time and effort than before.

Best Practice

It is easier to develop by referencing some exercise questions and how to avoid potential mistakes that are easy to make in program development.

For those people

If you have never developed a website program, this is not suitable for you. You should have at least some HTML language and simple Web development terms. You do not need the previous ASP development experience (of course, better experience), but you must understand the concept of interactive Web program development, including the concepts of forms, scripts, and data interfaces.

1.3 install

Check your computer with Christchurch.

CPU Pentium II 450 or above, 733 recommended

Memory 256 M recommended 512 M

Hard Disk Space 1 GB or more

For Windows 2000 Pro Server AD Server, you can install IIS 5 and Windows 2000 SP1.

However, the computer in Christchurch is successfully installed with a C266 over 333 memory, 128 M hard drive, and 2G hard drive.

Check if IE 5.5 is used?

We also need MDAC (ADO) version 2.6 or later (which can be downloaded from the Microsoft website .)

Finally, Microsoft is the main character of our lecture. net Framework SDK. Download it at the absolute address is EN-US/setup.exe 111 M. Fortunately, if the bandwidth is not small, a friend of ADSL can reach full speed (if a friend cannot go down, Christchurch can help cut a disc, including MDAC iIE5.5 SP1 ,.. net SDK .)

Note: educational network friends, huh, in Beijing University of Science and Technology on the server, there is a complete file can be downloaded, the speed is not bad, the address is

Finally, run the installer and install. net to your computer.

1.4 Quick Start example for installing. NET Framework

Open the SDK Overview Link (. NET Framework SDK Overview), which has been added to your desktop during SDK installation.

Open the HTML page and click the. NET Framework Samples link.

Follow the installation steps to install the example.

After the installation is complete, you can access the example at http: // localhost/quickstart/default.htm.

Finally, when browsing the default document, you can select the ASP. NET link at the top of the page. This link contains ASP. NET
List of examples. This tutorial is currently the only complete tutorial in the international market and the only tutorial provided by Microsoft for us to learn Unfortunately, it is in full English.
The pioneers rely on it.

1.5 how to seek help when learning -- add to ASPNG discussion list

As one of the leader in the ever-expanding ASP. NET community, Charles Carroll has been dedicated to holding the list of ASP. NET discussions based on email. In fact, this discussion list has been stored since the first day of the Professional Development Conference (PDC) in early July. .

This discussion list is the best choice for learning and releasing increasingly rich ASP. NET developers' knowledge. Charles checks and filters all messages to ensure that published articles are related to this list, so that the discussion is not separated from the topic.

In addition to the Community list, the Microsoft. NET Framework Team also regularly participates in discussions and releases sample code. Recently Scott Guthrie released an ASP. NET example of dynamically generated images.

To join the discussion list, just access the ). On this page, you can find the complete list of email discussions for different topics related to ASP. NET. The most active list is ASPNGBeta. We recommend that you join this list. Select ASPNGBeta from the list. You can also directly access the to select the option for receiving email distribution as needed.

1.6 complete. NET solution demonstration

IBuySpy Microsoft ASP. NET Sample Application

IBuySpy is a fully functional e-commerce application. It details how to use ASP. NET to create a high-performance, scalable Web
Application. You can browse the sample application (including the complete source code and documentation) online, or download the complete C # Or Visual Basic. NET version application.


1.7 free. net Space

Brinkster Inc. is the largest free ASP Web hosting service provider. It provides free ASP. NET host services. Each member can obtain
5 MB space is used to test and learn ASP. NET. The member identities used for testing and learning give developers the opportunity to understand this new technology. Brinkster is free of charge
ASP host service has been in the leading position in the ASP/ASP. NET host service market for more than a year.

Http:// is not ideal)

1.8 foreign technical support websites

Is one of the more comprehensive ASP. NET community sites, managed by Steve Schofield. You can find more than 10 articles about ASP. NET
And the online ASP. NET Quick Start example. If you cannot install NET. SDK
A good choice. As A reward, you can also get the online version of chapter A Preview of ASP. NET published by Wrox Press.

Is another comprehensive ASP. NET site. ASPNG includes links to the following content: ASP. NET uploaded by Charles Carroll
Class and ASP. NET Workshop uploaded by Stephen Walther. Finally, ASPNG
It also includes an active email discussion list. For more information, see ).

Several articles on ASP. NET and Web-based ASP. NET forums organized by clues.

The online magazine for Wrox Press has 10 articles on ASP. NET ranging from ADO + to generating server controls.

Http:// 4 GuysFromRolla includes some articles and other related resources. This article covers the overview of ADO + and ASP. NET.

Http:// (English) Finally, contains a more comprehensive list of ASP. NET and available. NET related resources. From books, websites, and activities, you can find things you are interested in.

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: 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.