隨筆-6  評(píng)論-38  文章-40  trackbacks-0
          AjaxTags標(biāo)記初探

          文章是在這里了,但我也沒把這些文件弄到手。唉,不知如何是好。
          AjaxTags項(xiàng)目是在現(xiàn)有的Struts HTML標(biāo)記庫的基礎(chǔ)上,添加對(duì)AJAX支持

          ?
            AjaxTags項(xiàng)目是在現(xiàn)有的Struts HTML標(biāo)記庫的基礎(chǔ)上,添加對(duì)AJAX支持。 AjaxTags改寫了Struts標(biāo)簽類org.apache.struts.taglib.html.FormTag和org.apache.struts.taglib.html.BaseHandlerTag,并使用Struts的plugin技術(shù),使得Struts提供了對(duì)AJAX的支持。 以下是jsp中簡單的示例:

          <html:form action="example1" ajaxRef="example1">
            First Name: <html:text property="firstName" size="25" value="Frank" />
            <br>
            Last Name: <html:text property="lastName" size="25" value="Zammetti" />
            <br>
            <html:button property="button" value="Click to do Ajax!" ajaxRef="button" />
          </html:form>
          Result:<br>
          <span id="example1_resultLayer"> </span>

            注意:ajaxRef屬性。 ajaxRef屬性中內(nèi)容是在ajax-config.xml中定義的,例如本示例的配置部分如下:

          <!DOCTYPE ajaxConfig PUBLIC "ajaxConfig" "ajaxConfig">
          <ajaxConfig>
            <!-- Define a custom request handler that generates XML for example 2 -->
             <handler name="CustomXMLGenerator" type="request">
                <function>customGenerateXML</function>
                <location>customXMLGenerator.js</location>
             </handler>
             <!-- Configuration for example 1 -->
             <form ajaxRef="example1">
                <element ajaxRef="button">
                   <event type="onclick">
                      <requestHandler type="std:QueryString">
                         <target>example1.do</target>
                         <parameter>firstName=firstName,lastName=lastName</parameter>
                      </requestHandler>
                      <responseHandler type="std:InnerHTML">
                         <parameter>example1_resultLayer</parameter>
                      </responseHandler>
                   </event>
                </element>
             </form>
          </ajaxConfig>

            在配置文件中定義了該表單的屬性,以及按鈕觸發(fā)的事件和回寫結(jié)果的處理方法。采用很巧妙的封裝方法實(shí)現(xiàn)了Struts的AJAX調(diào)用。當(dāng)然Ajaxtags離實(shí)用階段還有相對(duì)長的一段距離,但它提供了一種在現(xiàn)有的軟件架構(gòu)上高效率開發(fā)ajax應(yīng)用程序的可行性方案。
          posted on 2006-11-26 17:22 一手的小窩窩 閱讀(171) 評(píng)論(0)  編輯  收藏 所屬分類: JAVA
          主站蜘蛛池模板: 凤山市| 安阳市| 阿坝县| 东阳市| 宜丰县| 淮滨县| 威远县| 泾源县| 稷山县| 望奎县| 若羌县| 保康县| 建阳市| 武汉市| 永吉县| 霍城县| 泰来县| 泾阳县| 南江县| 澳门| 吴川市| 南通市| 革吉县| 盘锦市| 荥经县| 华蓥市| 鲁甸县| 池州市| 揭东县| 广水市| 鹤岗市| 瑞丽市| 民和| 囊谦县| 惠水县| 巍山| 防城港市| 鹤壁市| 三原县| 建德市| 克拉玛依市|