ASP to JSP conversion: Comparison of processing the same functions

Source: Internet
Author: User
Tags dsn

I. Purpose:

Through the comparison between ASP and JSP for the same function processing, research and implement the conversion from ASP to JSP. From the perspective of practical application, we have selected some representative database-related functions, including three specific functions: Query, add, and delete.

Ii. Page Features:

1. Database names and table names are shared)

 
 
  1. database name:pdtdb  
  2. table name:pdtinfotable 

Used table structure sharing)

 
 
  1. create table pdtinfotable  
  2. (  
  3.  ID     char(20)    not null,  
  4.  ProductName    char(20)    ,  
  5.  primary key(ID)  

2. Function Description on each page

The first index and addaction use two pages:

 
 
  1.  index:  select * from table   
  2.           submit insert value(ID, ProductName)   go to  "addaction" 
  3. addaction:  get parameter: "ID" and "ProductName";  
  4.           Do the "insert function " go back "index" 

The second search uses one page:

 
 
  1. select * from table where  ID= parameter "ID" or ProductName= paramenter "ProductName"     
  2. submit "ID" and "ProductName" 

The third delete and deleteaction use two pages:

 
 
  1. deleteselect * from table 

Each row is followed by another hyperlink chain to deleteaction ).

 
 
  1. deleteaction: delete from pdtinfo where ID= parameter "ID" ,go back "delete" 

3. JavaBean

Use tax. mydb. class

Iii. Code comparison:

ASP to JSP, index:

 
 
  1. strConnection = "DSN=pdtdb;Database=pdtdb;" 
  2. Set objConn=Server.CreateObject("ADODB.Connection")  
  3. objConn.Open strConnection  
  4. Set objRS=Server.CreateObject("ADODB.Recordset")  
  5. Set objRS.ActiveConnection=objConn 

ASP to JSP, addaction

 
 
  1. strConnection = "DSN=pdtdb;Database=pdtdb;" 
  2. Set objConn=Server.CreateObject("ADODB.Connection")  
  3. objConn.Open strConnection  
  4. Set objRS=Server.CreateObject("ADODB.Recordset")  
  5. Set objRS.ActiveConnection=objConn 

ASP to JSP, search:

 
 
  1. strConnection = "DSN=pdtdb;Database=pdtdb;" 
  2. Set objConn=Server.CreateObject("ADODB.Connection")  
  3. objConn.Open strConnection  
  4. Set objRS=Server.CreateObject("ADODB.Recordset")  
  5. Set objRS.ActiveConnection=objConn 

ASP to JSP, delete

 
 
  1. strConnection = "DSN=pdtdb;Database=pdtdb;" 
  2. Set objConn=Server.CreateObject("ADODB.Connection")  
  3. objConn.Open strConnection  
  4. Set objRS=Server.CreateObject("ADODB.Recordset")  
  5. Set objRS.ActiveConnection=objConn 

ASP to JSP, deleteaction

 
 
  1. strConnection = "DSN=pdtdb;Database=pdtdb;" 
  2. Set objConn=Server.CreateObject("ADODB.Connection")  
  3. objConn.Open strConnection  
  4. Set objRS=Server.CreateObject("ADODB.Recordset")  
  5. Set objRS.ActiveConnection=objConn 
  1. Comparison of syntax and object: view the convertible functions of ASP and JSP
  2. Technical Comparison of ASP and JSP Functions
  3. How to add a web framework in Servlet
  4. What are servlets and common Servlet APIs?
  5. At the beginning of JSP Servlet Development

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.