我开发了一个iWisApi 程序,通过超链接调用此页面,现在需要处理超连接传递过来的代码
传递代码如下
A href="..\IWISAPIProject5.dll?&ApplyNo=234">然后我在接收方写如下代码,打开页面的会报地址错啊
procedure TIWServerController.IWServerControllerBaseNewSession(
  ASession: TIWApplication; var VMainForm: TIWAppForm);
begin
  ASession.Data := TUserSession.Create;
  ShowMessage(ASession.Request.QueryFields.Values['repno']);
end;那应该如何接收超连接传递过来的参数呢?

解决方案 »

  1.   

    楼上问题中有笔误,超链接中 applyno应为repno! 希望大家帮忙!
      

  2.   

    procedure TIWServerController.IWServerControllerBaseNewSession( 
      ASession: TIWApplication; var VMainForm: TIWAppForm); 
    这里的事件可是创建会话时的初始事件,不能用showmessage的,想想你想在哪弹出警告框?服务器端还是客户浏览器??ASession.Request.QueryFields.Values['repno']这句是可以接受到参数的。想知道你接受了什么参数,---------------
    在UserSession中定义个公共变量repnounit UserSessionUnit;interfaceuses
      IWUserSessionBase, SysUtils, Classes;type
      TIWUserSession = class(TIWUserSessionBase)
      private
        { Private declarations }
      public
        { Public declarations }
        repno : String;
      end;implementation{$R *.dfm}end. 把接受的到参数付给repnoprocedure TIWServerController.IWServerControllerBaseNewSession(
      ASession: TIWApplication; var VMainForm: TIWBaseForm);
    begin
      ASession.Data := TIWUserSession.Create(nil);
     
      UserSession.repno := ASession.Request.QueryFields.Values['repno'];
    end;在初始页面的label显示出来unit Unit2;interfaceuses
      Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes, Controls,
      IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl, IWControl,
      IWCompLabel;type
      TIWForm2 = class(TIWAppForm)
        iwlbl1: TIWLabel;
        procedure IWAppFormCreate(Sender: TObject);
      public
      end;implementationuses ServerController;{$R *.dfm}
    procedure TIWForm2.IWAppFormCreate(Sender: TObject);
    begin
      iwlbl1.Caption := UserSession.repno;
    end;initialization
      TIWForm2.SetAsMainForm;end.
      

  3.   

    当然你也可以直接初始页面中直接取出来procedure TIWForm2.IWAppFormCreate(Sender: TObject);
    begin
    //  iwlbl1.Caption := UserSession.repno;
      iwlbl1.Caption := WebApplication.Request.QueryFields.Values['repno'];
    end;我这些测试都是基于standalone application 下实现的
    http://127.0.0.1:8888/?repno=55