Marco Web Center

[an error occurred while processing this directive]

Home: Code Repository: Mastering Delphi 6

Chapter 23 - Project XslCust

Project Structure

XslCust.dpr
program XslCust;

{$APPTYPE CONSOLE}

uses
  WebBroker,
  CGIApp,
  XslCustDm in 'XslCustDm.pas' {customers: TWebAppPageModule} {*.xsl};

{$R *.RES}

begin
  Application.Initialize;
  Application.Run;
end.
XslCustDm.pas

unit XslCustDm;

interface

uses
  Windows, Messages, SysUtils, Classes, HTTPApp, WebModu, HTTPProd, ReqMulti,
  xmldom, XMLIntf, WebDisp, WebAdapt, WebComp, msxmldom, XMLDoc, XSLProd,
  Provider, DB, DBTables, XMLBrokr;

type
  Tcustomers = class(TWebAppPageModule)
    XSLPageProducer: TXSLPageProducer;
    WebAppComponents: TWebAppComponents;
    ApplicationAdapter: TApplicationAdapter;
    PageDispatcher: TPageDispatcher;
    AdapterDispatcher: TAdapterDispatcher;
    XMLBroker1: TXMLBroker;
    Table1: TTable;
    DataSetProvider1: TDataSetProvider;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  function customers: Tcustomers;

implementation

{$R *.dfm}  {*.xsl}

uses WebReq, WebCntxt, WebFact, Variants;

function customers: Tcustomers;
begin
  Result := Tcustomers(WebContext.FindModuleClass(Tcustomers));
end;

initialization
  if WebRequestHandler <> nil then
    WebRequestHandler.AddWebModuleFactory(TWebAppPageModuleFactory.Create(Tcustomers, TWebPageInfo.Create([wpPublished {, wpLoginRequired}], '.xsl'), caCache));

end.
XslCustDm.dfm
object customers: Tcustomers
  OldCreateOrder = False
  PageProducer = XSLPageProducer
  AppServices = WebAppComponents
  Left = 254
  Top = 107
  Height = 296
  Width = 233
  object XSLPageProducer: TXSLPageProducer
    Active = True
    XMLData = XMLBroker1
    Left = 48
    Top = 8
    DOMVendorDesc = 'MSXML'
  end
  object WebAppComponents: TWebAppComponents
    PageDispatcher = PageDispatcher
    AdapterDispatcher = AdapterDispatcher
    ApplicationAdapter = ApplicationAdapter
    Left = 48
    Top = 56
  end
  object ApplicationAdapter: TApplicationAdapter
    Left = 48
    Top = 104
    object TAdapterDefaultActions
    end
    object TAdapterDefaultFields
    end
  end
  object PageDispatcher: TPageDispatcher
    Left = 48
    Top = 152
  end
  object AdapterDispatcher: TAdapterDispatcher
    Left = 48
    Top = 200
  end
  object XMLBroker1: TXMLBroker
    Params = <>
    ProviderName = 'DataSetProvider1'
    WebDispatch.PathInfo = 'XMLBroker1'
    Left = 144
    Top = 40
  end
  object Table1: TTable
    Active = True
    DatabaseName = 'DBDEMOS'
    TableName = 'customer.db'
    Left = 144
    Top = 160
  end
  object DataSetProvider1: TDataSetProvider
    DataSet = Table1
    Constraints = True
    Left = 152
    Top = 104
  end
end