⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 代码清单4-4.htm

📁 《深入浅出Ajax》 源代码
💻 HTM
📖 第 1 页 / 共 3 页
字号:
font-family:仿宋_GB2312;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"MS Reference Sans Serif";mso-bidi-font-family:"Times New Roman"'>实际完成客户端请求内容</span><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'><o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#006 <span style='mso-spacerun:yes'>&nbsp;&nbsp;</span>*
@author <span class=SpellE><span class=GramE>william</span></span><o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#007<span style='mso-spacerun:yes'>&nbsp;&nbsp; </span>*<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#008<span style='mso-spacerun:yes'>&nbsp;&nbsp; </span>*/<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#<span class=GramE>009<span style='mso-spacerun:yes'>&nbsp;
</span>public</span> class <span class=SpellE>TestMethod</span> {<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#010<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>/**<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#011<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
style='mso-spacerun:yes'>&nbsp;</span>* </span><span style='font-size:9.0pt;
font-family:仿宋_GB2312;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"MS Reference Sans Serif";mso-bidi-font-family:"Times New Roman"'>客户端简单调用服务器端方法</span><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'><o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#012<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
style='mso-spacerun:yes'>&nbsp;</span>*/<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#013<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>public
void <span class=SpellE><span class=GramE>simpleInvoke</span></span><span
class=GramE>(</span>){<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#014<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
class=SpellE>System.out.println</span>(&quot;</span><span style='font-size:
9.0pt;font-family:仿宋_GB2312;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"MS Reference Sans Serif";mso-bidi-font-family:"Times New Roman"'>服务器端方法<span
class=GramE>简单被</span>客户端调用</span><span lang=EN-US style='font-size:9.0pt;
mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:"Times New Roman"'>&quot;);<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#015<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#016<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>/**<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#017<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
style='mso-spacerun:yes'>&nbsp;</span>* </span><span style='font-size:9.0pt;
font-family:仿宋_GB2312;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"MS Reference Sans Serif";mso-bidi-font-family:"Times New Roman"'>客户端向服务器端发送简单字符串,由服务器返回</span><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'><o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#018 <span style='mso-spacerun:yes'>&nbsp;</span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
style='mso-spacerun:yes'>&nbsp;</span>* @<span class=SpellE>param</span>
message </span><span style='font-size:9.0pt;font-family:仿宋_GB2312;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"MS Reference Sans Serif";mso-bidi-font-family:
"Times New Roman"'>客户端传回的消息</span><span lang=EN-US style='font-size:9.0pt;
mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:"Times New Roman"'><o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#019<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
style='mso-spacerun:yes'>&nbsp;</span>* @return </span><span style='font-size:
9.0pt;font-family:仿宋_GB2312;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"MS Reference Sans Serif";mso-bidi-font-family:"Times New Roman"'>返回客户端简单消息</span><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'><o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#020<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
style='mso-spacerun:yes'>&nbsp;</span>*/<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#021<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>public
String <span class=SpellE><span class=GramE>stringFromClientAndBack</span></span><span
class=GramE>(</span>String message){<span style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#022<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
class=SpellE>System.out.println</span>(&quot;</span><span style='font-size:
9.0pt;font-family:仿宋_GB2312;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"MS Reference Sans Serif";mso-bidi-font-family:"Times New Roman"'>客户端发送信息:</span><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>&quot;+message);<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#023<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>String
<span class=SpellE>rtnMessage</span> = &quot;'&quot;+message+&quot;'</span><span
style='font-size:9.0pt;font-family:仿宋_GB2312;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"MS Reference Sans Serif";mso-bidi-font-family:"Times New Roman"'>已由服务器接收</span><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>&quot;;<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#024<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#025<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
class=GramE>return</span> <span class=SpellE>rtnMessage</span>;<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#026<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#027<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>/**<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#028<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
style='mso-spacerun:yes'>&nbsp;</span>* </span><span style='font-size:9.0pt;
font-family:仿宋_GB2312;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"MS Reference Sans Serif";mso-bidi-font-family:"Times New Roman"'>客户端向服务器端发送数据集合,由服务器返回计算结果</span><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'><o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#029<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
style='mso-spacerun:yes'>&nbsp;</span>* @<span class=SpellE>param</span> <span
class=SpellE>params</span> </span><span style='font-size:9.0pt;font-family:
仿宋_GB2312;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:"MS Reference Sans Serif";
mso-bidi-font-family:"Times New Roman"'>客户端传回的数据集合</span><span lang=EN-US
style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'><o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#030<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
style='mso-spacerun:yes'>&nbsp;</span>* @return </span><span style='font-size:
9.0pt;font-family:仿宋_GB2312;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"MS Reference Sans Serif";mso-bidi-font-family:"Times New Roman"'>返回计算结果</span><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'><o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#031<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
style='mso-spacerun:yes'>&nbsp;</span>*/<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#032<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>public
<span class=SpellE>int</span> <span class=SpellE><span class=GramE>collectionFromClientAndBack</span></span><span
class=GramE>(</span><span class=SpellE>int</span>[] <span class=SpellE>params</span>){<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span
lang=EN-US style='font-size:9.0pt;mso-fareast-font-family:仿宋_GB2312;mso-bidi-font-family:
"Times New Roman"'>#033<span style='mso-spacerun:yes'>&nbsp; </span><span
style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
class=SpellE>int</span> total = 0;<o:p></o:p></span></p>

<p class=a style='margin-left:0cm;text-align:justify;text-justify:inter-ideograph;
text-indent:18.0pt;mso-char-indent-count:2.0;background:#E6E6E6'><span

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -