asp,asp.net,jsp syntax, built-in object comparison

Source: Internet
Author: User

1 individual Helloword version 1.1 ASP

<%
Response.Write ("Hello ASP")
%>

The file name is test.asp.

1.2 ASP.

<%@ page language= "C #"%>
<%
Response.Write ("Hello asp");
%>

The file name is test.aspx.

It is important to note that because ASP. NET supports multiple language development, and the default language is vb.net, which uses the C # language, it must be explicitly controlled. Otherwise compile will follow vb.net, thus error!

1.3 JSP

<%
Out.println ("Hello jsp");
%>

File name is test.jsp

1.4 Analysis

asp,aspx,jsp all use the same embed syntax <% code%>, and both have built-in objects for outputting text, Asp-response,asp.net-response, Jsp-out.

For languages, VBScript is not case-sensitive, while C # and Java are distinguished;

For naming conventions, the classes, properties, and methods of VBScript and C # are capitalized, while Java is accustomed to starting with lowercase letters in addition to the rest of the class.

2 Basic Syntax 2.1 embedding expressions

(1) ASP

<%=%>

(2) ASP.

<%=%>

(3) JSP

<%=%>

Visible, the three are exactly the same.

2.2 Embedding declarations

(1) ASP

<script language= "VBScript" runat= "server>

Sub F
Response.Write ("Hello asp from Script")
End Sub

</script>

(2) ASP.

<script language= "C #" runat= "Server" >

void F ()

{

Response.Write ("ASP. NET from script");

}

</script>

(3) JSP

<%!

public void F ()

{

OUT.PRINTLN ("JSP");

}

%>

As can be seen, ASP and ASP. NET uses the same syntax, but the JSP is different.

2.4 Embedding Program Fragments

(1) ASP

<% Program Fragment%>

(2) ASP.

<% Program Fragment%>

(3) JSP

<% Program Fragment%>

The syntax of the three visible is exactly the same.

3 Built-in objects 3.1 ASP

(1) Request object

Represents the information that the client sends to the server side. Carry such as user-side browser information, request string, form data, cookies and so on.

(2) Response object

Represents the server-side return to the client related content and operations, it can be set to return content, return cookie settings, whether cache and so on.

(3) Application Object

Represents the entire application and is a variable within the scope of application. Multiple pages share it, so it involves concurrent access issues, so the lock and unlock methods are provided for synchronous processing.

(4) Session object

Represents a session, the session has a unique ID identifier, and the client typically provides the identity of the session through a cookie or a request string.

(5) Server object

Represents the server-side environment and provides basic operations such as registering components, mapping paths, and so on.

(6) ObjectContext Object

Used to control the transaction processing of ASP, which is seldom used directly in programming.

3.2 ASP.

(1) Request object

The function is the same as the request in ASP.

(2) Response object

The function is the same as the request in ASP.

(3) Application Object

The function is the same as the application in ASP.

(4) Session object

The function is the same as the session in ASP.

(5) Server object

The function is the same as the session in ASP.

(6) Page object

Represents the current page, or the compiled class.

3.3 JSP

(1) Request object

The function is the same as the request in Asp,asp.net, the JSP is lowercase.

(2) Response object

The function is similar to the response in Asp,asp.net, the JSP is lowercase.

(3) Application Object

The function is the same as the application in Asp,asp.net, the JSP is lowercase.

(4) Session object

The function is the same as the session in Asp,asp.net, the JSP is lowercase.

(5) Out object

Implements the output to the client, acting like Response.Write () in Asp,asp.net.

(6) Page object

Represents the current page, or a compiled servlet.

4 objects used by database access 4.1 ASP

ASP uses ADO technology to access the database.

(1) Connection class

Represents a connection to a database management system.

Set conn = Server.CreateObject ("ADODB. Connection ")

(2) Command class

Executes commands against a connected database.

(3) Recordset class

Record set.

Set rs = Server.CreateObject ("ADODB". Recordset ")

(4) Field class

(5) Parameter class

(6) Property class

(7) Error class

4.2 ASP.

ASP. NET uses ADO to access the database.

(1) SqlConnection

Same as the connection in ASP.

(2) SqlCommand

Same as command in ASP.

(3) DataSet

Similar to the recordset in ASP.

4.3 JSP

The JSP uses JDBC technology to access the database.

(1) Connection class

Responsible for connection to database.

(2) Statemaent class

Similar to command in ASP, responsible for the execution of SQL statements.

(3) ResultSet

The result set, similar to the ASP's Recordset, and the DataSet for ASP.

5 Conclusion

By analyzing the comparison, we can see that asp,asp.net,jsp has much in common, which is the normalization and process of HTTP and SQL database processing, and its design idea is exactly the same, but the technical realization has the details difference.

Although the respective development environment, coding specifications and so on there is a small difference, but because of its design concept and processing process is very similar, so a project at the beginning often only one version, once the later development of the better, will be introduced another platform version, such as Discuz is the first PHP development, Later, the version of ASP. It is not surprising that the same programmer who has mastered any platform has 90% of the development experience that can be used on other platforms, and it takes only 2 weeks for many programmers to convert between ASP and JSP.

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.