Delphi Clinic | C++Builder Gate | Training & Consultancy | Delphi Notes Weblog | Dr.Bob's Webshop |
|
Borland Delphi 4 Client/Server Suite contains WebBroker technology, also called Web Modules - a set of Wizards and Components to create CGI, WinCGI or ISAPI/NSAPI web server applications. This article will cover some of the main Delphi 4 C/S specific enhancements to these Web Modules.
DB Web Application Wizard
Delphi 3 C/S offered us just one Wizard to start a new Web Module project, but with Delphi 4 C/S we can also create a new Database Web Module Application with the DB Web Application Wizard (to be found in the File | New Repository in the Business page):
Once we start the Database Web Application Wizard, we can specify the type of Web Module Application (ISAPI/NSAPI is the default choice), and the DataSet option - using a TTable or a TQuery component. Note that no matter which component we pick (Table or Query), we'll always end up with a TDataSetTableProducer connected to this DataSet.
The Database Web Application Wizard resembles the "normal" Database Form Wizard, with the exception that we cannot create a Master-Detail Web Module Application (we only get a single Table or Query). Once we specified the Alias and Table, and selected the Fields that we want to see, we get to the fourth page of the Database Web Application Wizard which is Web Module specific:
The options that we specify at this page will end up as property values of the TDataSetTableProducer in the Web Module that gets created upon completion of the Wizard. The generated Web Module contains a TTable (or TQuery) component, a TDataSetTableProducer component, and a TSession component (with AutoSessionName set to True).
IntraBob
The final page of the Database Web Application Wizard mentions the fact that - in order to test and debug a Web Module Application - one needs a Web Server and Web Browser.
Fortunately, visitors of my website know this is not necessarily the case, as IntraBob v3.01 is often good enough to test Web Module Applications without needing anything else (except for Delphi, that is).
In fact, using IntraBob v3.01 to debug ISAPI/NSAPI Web Module DLLs, we should specify IntraBob as hosting application (using Run | Parameters), and make sure IntraBob is in the same directory as the ISAPI DLL to debug.
We may have to write a sample CGI HTML Form to specify the ISAPI DLL, but usually we can use a skeleton like the CGI HTML Form below:
<HTML> <BODY> <FORM ACTION="project1.dll" METHOD=POST> <INPUT TYPE=submit> </FORM> </BODY> </HTML>Where "project1.dll" is the actual name of the ISAPI DLL we want to debug. Of course, if we need to use any CGI input variables, we should add these to the above CGI HTML Form as well.
Note that the above screenshot also shows the new IDE features on the left pane (Published part of TWebModule1, Variables/Constants in the unit, and the Uses clause).
The new DB Web Application Wizard is a nice addition to Delphi 4 C/S Web Module. However, I do miss the feature to create a Master-Detail relationship (I'm about to write my own Wizard to support this as well), and I also fear that the TDataSetTableProducer is not always the most suited component for the job. In fact, sometimes I would really want to use another new addition... the TDataSetPageProducer!
TDataSetPageProducer
The TDataSetPageProducer component is a mix between the TPageProducer (with invisible HTML #-Tags that get replaced by dynamic values) and the TQueryTableProducer (that can connect parameter names with CGI HTML variable names).
A TDataSetPageProducer can contain a HTML "template", just like a TPageProducer, where we can use tags that only need to consist of the name of a field from the connect DataSet to replace these tags by the actual value of these fields.
So, if a field is named "Length", then we need to put a tag "<#Length>" on the HTML template of the TDataSetPageProducer to make sure the tag is replaced by the actual value of the "Length" field of the current record in the DataSet.
Quite helpful if you want to produce data-aware webpages, but don't want to produce Table-like output with the TDataSetTableProducer or the TQueryTableProducer.