Mega Code Archive

 
Categories / Delphi / Examples
 

Using ASP Express toolkit for developing Web applications

Title: Using ASP Express toolkit for developing Web applications Question: The article describes a way to access and modify data in database through the web using ASP Express toolkit that was specially designed to simplify development of database applications. Answer: Abstract ASP Express was designed from the ground up to simplify Web Application Development for Delphi developers. The tool relies on the latest technologies supported on Microsoft Windows Platform - HTML, XML/XSL, MTS/COM+, IIS and ASP. The tool enables rapid development of data-aware Web applications. It significantly simplifies development of database application for the Web. ASP Express applications are accessible from any forth-generation browsers such as Netscape Communicator and Internet Explorer. ASP Express is available at no charge to anyone interested in building modern Internet applications with Delphi 5. There are no fees or royalties associated with using this product, although the source code is not a part of the free offer. You can download the latest version of ASP Express for free from here. Database Access on the Web Using ASP Express The core of data access support was modeled after very successful database management technology Borland MIDAS, that was introduced in Delphi three years ago. Data access components of ASP Express utilize XML to maintain snapshots of database information and to keep track of changes made by user. This allows robust transactional database access. XML snapshots also maintain some User Interface related information. The following diagram explains data access mechanism used in ASP Express applications: TXMLData component is used to manipulate with XML snapshots of database information in presentation code. Due to the stateless nature of web applications each time when new request is received from some web browser, application will identify user session and try to retrieve user data from session storage. If session storage is not able to locate requested data snapshot then TXMLProvider is activated in order to produce XML data snapshot from the actual database. This information is persisted in the session storage and then it becomes available to presentation components. User activities may lead to some data modifications that are recorded right in the XML snapshot. At some point when user press Save Changes button for example the presentation code will send data modification to TXMLResolver, that will reproduce all changes in the same sequence as they were recorded in XML snapshot. While playing this record TXMLResolver will generate SQL statements and execute them against the real data store. ASP Express includes TXMLResolver, TXMLADOResolver, TXMLBDEResolver and TXMLIBResolver. In this article we will learn how to implement the simplest data aware application. We are going to use TXMLProvider, TXMLData, TXMLADOResolver and TASPXEditView. Building Business Services Create new ActiveX Library project and add two MTS Data Modules to it. Name these modules BusinessServices and PresentationServices. Save all files according to this table: FileModule/ObjectDescriptionCustServ.dprlibrary CustServMain program file.Unit1.pasTBusinessServicesImplements IBusinessServices interface.Unit2.pasTPresentaionServices Implements IPresentationSevices interface.CustServ_TLB.pasObject Pascal declarations of type library contentGenerated by Delphi IDE automatically each time when you update Type Library content.