The basic code knowledge that Xiaobai must master before building a website

To build a website by yourself, it is necessary and necessary to master a web programming language. We all know that no matter how colorful web pages are, they are all realized by language programming. In this article, I mainly introduce several common web page languages, focusing on the common knowledge points of HTML and ASP language web page programming.

1. HTML language

HTML is a language that adds marks to certain words and sentences in ordinary documents. The purpose is to use tags to achieve the desired display effect of the document. HTML is just a markup language. Basically, as long as you understand the usage of various tags, you can even understand HTML.

The HTML format is very simple, just a combination of text and markup. For editing, any text editor is fine, as long as the file can be saved in .html format. Of course, it is recommended that professional web editing software be the best.

The purpose of designing the HTML language is to be able to conveniently link the text or graphics stored in one computer with the text or graphics in another computer to form an organic whole, regardless of whether the specific information is currently present. On the computer, or on other computers on the network.

Just use the mouse to click on an icon in a certain document, and the Internet will immediately go to the content related to the icon, and this information may be stored in another computer on the network.

Insert picture description here
HTML text is descriptive text composed of HTML commands. HTML commands can describe text, graphics, animations, sounds, tables, links, etc. The structure of HTML includes two parts: Head and Body. The header describes the information required by the browser, and the body includes the specific content to be explained.

In addition, HTML is the universal language in the Internet, a simple and universal all-inclusive markup language. It allows web creators to create complex pages that combine text and images. These pages can be viewed by anyone else on the Internet, no matter what type of computer or browser is used.

Two, ASP language

ASP is the abbreviation of Active Server Page, which means "dynamic server page". ASP is an application developed by Microsoft to replace CGI script programs. It can interact with databases and other programs. It is a simple and convenient programming tool. The format of ASP web page files is .asp, which is now commonly used in various dynamic websites.

ASP is a server-side scripting environment that can be used to create and run dynamic web pages or Web applications. ASP web pages can contain HTML tags, ordinary text, script commands, and COM components. Using ASP, you can add interactive content (such as online forms) to web pages, and you can also create web applications that use HTML pages as a user interface. Compared with HTML, ASP pages have the following characteristics:

1. Using ASP can break through some functional limitations of static webpages and realize dynamic webpage technology.

  1. ASP files are included in files composed of HTML codes, which are easy to modify and test.

3. The ASP interpreter on the server will execute the ASP program on the server side and transmit the result to the client browser in HTML format, so you can browse the web pages generated by ASP normally using various browsers.

  1. ASP provides some built-in objects, using these objects can make server-side scripting more powerful. For example, you can get the information submitted by the user through the HTML form from the web browser, process the information in the script, and then send the information to the web browser.

Insert picture description here
6. ASP can use server-side ActiveX components to perform various tasks, such as accessing databases, sending emails, or accessing file systems.

6. Since the server transmits the results of the ASP program execution back to the client browser in HTML format, the user will not see the original program code written by ASP, which prevents the ASP program code from being stolen.

7. It is convenient to connect ACCESS and SQL database.

8. Development requires a wealth of experience, otherwise it will leave loopholes that can be exploited by crackers for injection attacks. ASP is not only limited to combining with HTML to make Web sites, it can also be combined with XHTML and WML to make WAP mobile sites. The principle is the same.

Three, JSP language

JSP and Servlet are discussed together because they are both part of Sun's J2EE (Java 2 platform Enterprise Edition) application system.

The form of Servlet is similar to the aforementioned CGI, and its HTML code and background program are separated. Their startup principles are similar. The server responds after receiving the client's request.

The difference is that CGI opens a process for each client request, but the servlet is loaded in response to the first request. Once the servlet is loaded, it is in the executed state.

For future requests from other users, it does not open the process, but opens a thread (Thread), and sends the results to the client. Because threads can share resources by generating their own parent threads (Parent Thread), this reduces the burden on the server. Therefore, Java Servlet can be used for large-scale application services.

Insert picture description here
Although JSP and ASP or PHP look very similar in form-both can be embedded in HTML code. However, its implementation is completely different from ASP or PHP.

When the JSP is executed, the JSP file is converted into Servlet code by the JSP Parser, and then the Servlet code is compiled into a .class byte file by the Java compiler, so that the generated Servlet responds to the client. Therefore, JSP can be regarded as the Script Language version of Servlet.

Since JSP/Servlet are all based on Java, they also have the biggest advantage of the Java language-platform independence, which is the so-called "Write Once, Run Anywhere" (WORA-Write Once, Run Anywhere).

In addition to this advantage, the efficiency and security of JSP/Servlet are also quite amazing. Therefore, although JSP/Servlet is not widely used in China, its future is limitless.

When debugging JSP code, if the program makes a mistake, the JSP server will return an error message and display it in the browser. Since JSP is first converted to Servlet and then run, the number of lines with errors in the code displayed in the browser is not the number of lines of the JSP source code, but the number of lines of the converted Servlet program code.

This brings certain difficulties to debugging code. Therefore, when troubleshooting errors, you can take the method of segmentation elimination (output some strings before and after the code that may be wrong, and use whether the string is output to determine where the code segment started error), and gradually narrow the scope of the error code segment, and finally Determine the location of the error code.

Four, PHP language

The full name of PHP is very interesting, it is a nested abbreviated name-"PHP: Hypertext Preprocessor", open abbreviation or abbreviation. PHP is an HTML embedded language (like ASP mentioned above).

The unique syntax of PHP is a mixture of C, Java, Perl, and PHP-style new syntax. It can execute dynamic web pages faster than CGI or Perl.

The source code of PHP is completely open. Today, with the rise of Open Source awareness, it is the mainstay in this regard. Constantly adding new function libraries, and constantly updating, make PHP have more new functions regardless of the UNIX or Win32 platform. The rich functions it provides have better resources in terms of programming.

Insert picture description here
Platform independence is the biggest advantage of PHP, but behind the advantages, there are still some small disadvantages. If you do not use ODBC in PHP, but use its built-in database function (this is more efficient than using ODBC) to connect to the database, using different databases, PHP function names cannot be unified.

This makes the porting of the program a little troublesome. However, as the most widely used back-end language, the advantages of PHP are still very obvious.

Five, ASP.NET language

The latest version of ASP, ASP.NET, is not fully backward compatible with earlier versions of ASP because the software has been completely rewritten. The early ASP technology actually has much more in common with PHP than with ASP.NET, which is a complete framework for building Web applications.

One of the main features of this model is the flexibility of choosing a programming language. ASP.NET can use scripting languages ​​(such as VB script, Jscript, Perl script, and Python) and compiled languages ​​(such as VB, C#, C, Cobol, Smalltalk, and Lisp).

The new framework uses a common language runtime (CLR); the source code is compiled into Microsoft intermediate language code, and then the CLR executes the code.

This framework also provides true object-oriented programming (OOP), and supports true inheritance, polymorphism, and encapsulation. The .NET class library is organized into inheritable classes according to specific tasks (for example, using XML or image processing).

Insert picture description here
In addition to programming languages ​​and methods, database access is also a factor to focus on. When you use ASP.NET to program, you can use ODBC to integrate the database; ODBC provides a set of consistent calling functions to access the target database.

The advantage of ASP.NET is obvious, lies in its simple design and implementation. This is the dream of object-oriented programmers-the language is flexible and supports complex object-oriented features.

Another advantage of ASP.NET is its development environment. For example, developers can use WebMatrix (a community-supported tool), Visual Studio.NET, or various Borland tools (such as Delphi and C++Builder).

For example, Visual Studio allows you to set breakpoints, trace code segments, and view the call stack. All in all, it is a complex debugging environment. Many other third-party ASP.NET IDE solutions will inevitably appear.

The above is the basic knowledge of code that an individual must master before building a website. If you are new to these common web languages, find time to concentrate on studying and conquering them. For those interested in code, it is not difficult to master these.
Some people may say that I don't have any code foundation, and this knowledge is still too difficult for me! But I just want to experience the fun of building a website by myself. Is there any way to achieve it? Have. We recommend Alibaba Cloud's website building product- Cloud Express Beauty Station . A website can be launched within an hour as soon as it is built.

The above content is original by Alibaba Cloud website technology researcher [Beike], please indicate the source for reprinting.

Guess you like

Origin blog.csdn.net/beike0078/article/details/108711114