• delphi xe---intraweb基本介绍


    版本10 seattle

    新建intraWeb 

    new->other->Delphi Projecs->IntraWeb->IntraWeb Application wizard

    建立测试工程时, 一般要使用 StandAlone Application, 这方便调试; 具体发布时只需稍稍修改.

    自动生成,以下几个文件

     Project1

    program Project1;

    uses
    Vcl.Forms,  ---这里本来是生成是Forms,     //报错,看了万一的博客说了这句“   还是以前的那个 Forms, 现在叫 Vcl.Forms 了 ”,改了不报错

    IWStart,
    UTF8ContentParser,
    Unit1 in 'Unit1.pas' {IWForm1: TIWAppForm},
    ServerController in 'ServerController.pas' {IWServerController: TIWServerControllerBase},  //这才是 IntraWeb 工程的核心单元, 每个工程都会在该单元自动建立一个(只有一个)                                           Server Controller 对象, 这个对象统管所有(包括 Session)


    UserSessionUnit in 'UserSessionUnit.pas' {IWUserSession: TIWUserSessionBase};   //该单元主要维护一个 Session 数据对象, 并提供给 ServerController 使用

    {$R *.res}

    begin
    TIWStart.Execute(True);
    end.

    //这里的代码是自动维护的; 只有在修改发布模式时, 才会来这里做简单的修改(譬如把 program Project1 改为 library Project1 


    UserSessionUnit;

    unit UserSessionUnit;

    {
    This is a DataModule where you can add components or declare fields that are specific to
    ONE user. Instead of creating global variables, it is better to use this datamodule. You can then
    access the it using UserSession.
    }

    {注释}
    //该单元目前只有一个空的 TIWUserSession, 但也已被 ServerController 单元 uses 并使用
    //不同的网站程序对用户信息的需求可能不一样(譬如: 登陆信息、购物车信息等等), 我们可以在这里定义需要的数据格式; 因为灵活性很大, 所以关于 Session 的方便操作也是 IW 在宣传时首先要吹嘘的
    //在它的窗体上可以放置非可视控件
    //TIWUserSessionBase 的父类是我们熟悉的 TDataModule, 所以我说这是 Session 相关的数据模块.


    interface

    uses
    IWUserSessionBase, SysUtils, Classes;

    type
    TIWUserSession = class(TIWUserSessionBase)
    private
    { Private declarations }
    public
    { Public declarations }
    end;

    implementation

    {$R *.dfm}

    end.

    ServerController;

    unit ServerController;

    interface

    uses
    SysUtils, Classes, IWServerControllerBase, IWBaseForm, HTTPApp,
    // For OnNewSession Event
    UserSessionUnit, IWApplication, IWAppForm;

    type
    TIWServerController = class(TIWServerControllerBase)
    procedure IWServerControllerBaseNewSession(ASession: TIWApplication);

    private

    public
    end;


    function UserSession: TIWUserSession;
    function IWServerController: TIWServerController;

    implementation

    {$R *.dfm}

    uses
    IWInit, IWGlobal;

    function IWServerController: TIWServerController;
    begin
    Result := TIWServerController(GServerController);
    end;

    function UserSession: TIWUserSession;
    begin
    Result := TIWUserSession(WebApplication.Data);
    end;

    procedure TIWServerController.IWServerControllerBaseNewSession(
    ASession: TIWApplication);
    begin
    ASession.Data := TIWUserSession.Create(nil);
    end;


    initialization
    TIWServerController.SetServerControllerClass;

    end.

  • 相关阅读:
    关于asp.net中Repeater控件的一些应用
    Linux查看程序端口占用情况
    php 验证身份证有效性,根据国家标准GB 11643-1999 15位和18位通用
    给Nginx配置一个自签名的SSL证书
    让你提升命令行效率的 Bash 快捷键 [完整版]
    关系数据库常用SQL语句语法大全
    php 跨域 form提交 2种方法
    Vimium~让您的Chrome起飞
    vim tab设置为4个空格
    CENTOS 搭建SVN服务器(附自动部署到远程WEB)
  • 原文地址:https://www.cnblogs.com/michellexiaoqi/p/7440271.html
Copyright © 2020-2023  润新知