阳
阳光游子
Unregistered / Unconfirmed
GUEST, unregistred user!
设想的功能为:
当输入地址 http://localhost/Project1.dll?a=X 时,其中a=后面为测试数据
1、当测试数据不是整数时,提示“请输入整数!”(此功能正常!)
2、当测试数据是整数时,先保存在全局变量S中,再输出S的值(奇怪的是,输出的S总是前一次输入的值,而不是本次输入的值。)
目前程序代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, HTTPApp;
type
TWebModule1 = class(TWebModule)
PageProducer1: TPageProducer;
procedure WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
procedure PageProducer1HTMLTag(Sender: TObject; Tag: TTag;
const TagString: String; TagParams: TStrings;
var ReplaceText: String);
private
{ Private declarations }
function aa(a:String;var Response: TWebResponse):Boolean;
public
{ Public declarations }
end;
var
WebModule1: TWebModule1;
s:String;
implementation
{$R *.DFM}
function TWebModule1.aa(a:String;var Response: TWebResponse):Boolean;
begin
Result := StrToIntDef(a,0)=StrToIntDef(a,1);
if not Result then Response.Content := '<SCRIPT language=JavaScript>alert(''请输入整数!'');</SCRIPT>'
else s := a;
end;
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
Result : Boolean;
begin
if not aa(Request.QueryFields.Values['a'],Response) then Exit;
end;
procedure TWebModule1.PageProducer1HTMLTag(Sender: TObject; Tag: TTag;
const TagString: String; TagParams: TStrings; var ReplaceText: String);
begin
if TagString='aaa' then ReplaceText := s;
end;
end.
请各位前辈指教,谢谢`````````````````
当输入地址 http://localhost/Project1.dll?a=X 时,其中a=后面为测试数据
1、当测试数据不是整数时,提示“请输入整数!”(此功能正常!)
2、当测试数据是整数时,先保存在全局变量S中,再输出S的值(奇怪的是,输出的S总是前一次输入的值,而不是本次输入的值。)
目前程序代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, HTTPApp;
type
TWebModule1 = class(TWebModule)
PageProducer1: TPageProducer;
procedure WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
procedure PageProducer1HTMLTag(Sender: TObject; Tag: TTag;
const TagString: String; TagParams: TStrings;
var ReplaceText: String);
private
{ Private declarations }
function aa(a:String;var Response: TWebResponse):Boolean;
public
{ Public declarations }
end;
var
WebModule1: TWebModule1;
s:String;
implementation
{$R *.DFM}
function TWebModule1.aa(a:String;var Response: TWebResponse):Boolean;
begin
Result := StrToIntDef(a,0)=StrToIntDef(a,1);
if not Result then Response.Content := '<SCRIPT language=JavaScript>alert(''请输入整数!'');</SCRIPT>'
else s := a;
end;
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
Result : Boolean;
begin
if not aa(Request.QueryFields.Values['a'],Response) then Exit;
end;
procedure TWebModule1.PageProducer1HTMLTag(Sender: TObject; Tag: TTag;
const TagString: String; TagParams: TStrings; var ReplaceText: String);
begin
if TagString='aaa' then ReplaceText := s;
end;
end.
请各位前辈指教,谢谢`````````````````