打印本文 打印本文 关闭窗口 关闭窗口
Web Application 開 發 利 器 - WebSnap(十)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数643  更新时间:2009/4/23 18:40:15  文章录入:mintao  责任编辑:mintao


Web Application 開 發 利 器 - WebSnap!

第 十 章 、 WebService+WebSnap

  還 記 得 我 曾 經 說 過 要 與 你 討 論 將 WebService 應 用 在 WebSnap 中 嗎 ? 相 信 你 對 如 何 做 已 經 有 概 念 了 , 這 很 簡 單 , 你 只 要 建 立 一 個 新 的 Page Module 在 裡 面 使 用 HTTPRIO 就 可 以 了 : 

procedure TWebService.AdaptGoExecute(Sender: TObject; Params: TStrings);

var

  URL:string;

begin

  if AdaptNewsType.ActionValue.Values[0] = ''''DelphiNews'''' then

     URL:=(HTTPRIO1 as IHeadLine).DelphiNews(1)

  else if AdaptNewsType.ActionValue.Values[0] = ''''CBuilderNews'''' then

     URL:=(HTTPRIO1 as IHeadLine).CBuilderNews(1)

  else if AdaptNewsType.ActionValue.Values[0] = ''''JBuilderNews'''' then

     URL:=(HTTPRIO1 as IHeadLine).JBuilderNews(1)

  else if AdaptNewsType.ActionValue.Values[0] = ''''KylixNews'''' then

     URL:=(HTTPRIO1 as IHeadLine).KylixNews(1)

  else if AdaptNewsType.ActionValue.Values[0] = ''''SoapNews'''' then

     URL:=(HTTPRIO1 as IHeadLine).SoapNews(1)

  else if AdaptNewsType.ActionValue.Values[0] = ''''BorConNews'''' then

     URL:=(HTTPRIO1 as IHeadLine).BorConNews(1);

  Response.Content:=URL; 

end;

  AdaptGoExecute 是 一 個 Action , AdaptNewsType 則 是 一 個 AdapterField , 你 應 該 很 清 楚 如 何 結 合 她 們 , 範 例 程 式 中 有 這 段 程 式 碼 , 不 過 我 建 議 你 自 己 試 試 看 。 

 

<第 十 一 章 、 ImageButtonProducer 應 用>



打印本文 打印本文 关闭窗口 关闭窗口