Y
yeahsite
Unregistered / Unconfirmed
GUEST, unregistred user!
我用Delphi做web服务器,定义了webmodule控件
源代码如下
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var retvalue:TStrings;
var shtml:string;
var i:integer;
begin
retvalue:=NIL;
case request.MethodType of
mtGet:retvalue:=request.QueryFields;
mtPost:retvalue:=request.ContentFields;
end;
shtml:='<html>';
shtml:=shtml+'<head>';
shtml:=shtml+'<title>添加数据</title>';
shtml:=shtml+'</head>';
shtml:=shtml+'<body>';
shtml:=shtml+'<h1>你输入了下面的数据</h1>';
for i:=1 to retvalue.Count do shtml:=shtml+IntToStr(i)+':'+retvalue.Names
+'='+retvalue.Strings+'<br>';
shtml:=shtml+'</body>';
shtml:=shtml+'</html>';
response.content:=shtml;
end;
每次打开浏览器浏览时,总是只看到"你输入了下面的数据",下面就没有了
察看retvalue.count,原来等于0,显然是没有收到请求的字符串
请高手指教
源代码如下
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var retvalue:TStrings;
var shtml:string;
var i:integer;
begin
retvalue:=NIL;
case request.MethodType of
mtGet:retvalue:=request.QueryFields;
mtPost:retvalue:=request.ContentFields;
end;
shtml:='<html>';
shtml:=shtml+'<head>';
shtml:=shtml+'<title>添加数据</title>';
shtml:=shtml+'</head>';
shtml:=shtml+'<body>';
shtml:=shtml+'<h1>你输入了下面的数据</h1>';
for i:=1 to retvalue.Count do shtml:=shtml+IntToStr(i)+':'+retvalue.Names
+'='+retvalue.Strings+'<br>';
shtml:=shtml+'</body>';
shtml:=shtml+'</html>';
response.content:=shtml;
end;
每次打开浏览器浏览时,总是只看到"你输入了下面的数据",下面就没有了
察看retvalue.count,原来等于0,显然是没有收到请求的字符串
请高手指教