代码在这里
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, HTTPApp;
type
TWebModule1 = class(TWebModule)
procedure WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
procedure WebModule1WebActionItem2Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
WebModule1: TWebModule1;
implementation
{$R *.DFM}
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
Var
Page:TStringList;
begin
Page:=TStringList.Create;
Try
With Page Do
Begin
Add('<html>');
Add('<body>');
Add('<form action=test.cgi method=post>');
Add('<input type=text name=id>');
Add('<input type=submit value=同意>');
Add('</form>');
Add('</body>');
Add('</html>');
End;
Response.Content:=Page.Text;
Finally
Page.Free;
End;
Handled:=True;
end;
procedure TWebModule1.WebModule1WebActionItem2Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
Var
Page:TStringList;
begin
Page:=TStringList.Create;
Try
With Page Do
Begin
Add('<html>');
Add('<body>');
Add(Request.ContentFields.Values['id']);
Add('</body>');
Add('</html>');
End;
Response.Content:=Page.Text;
Finally
Page.Free;
End;
Handled:=True;
end;
end.