JAVA

          人生若只如初見,何事秋風(fēng)悲畫扇。

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            50 隨筆 :: 25 文章 :: 157 評論 :: 0 Trackbacks
          ?URLConnection?urlconn? = ?targeturl.openConnection();
          ????????????urlconn?
          = ?targeturl.openConnection();
          ????????????urlconn.setRequestProperty(
          " Content-Type " ,? " application/x-www-form-urlencoded " );
          ????????????urlconn.setRequestProperty(
          " method " ,? " post " );
          ????????????urlconn.setDoOutput(
          true );
          ????????????DataOutputStream?dos?
          = ? new ?DataOutputStream(urlconn.getOutputStream());
          ????????????OutputStreamWriter?output?
          = ? null ;
          ????????????output?
          = ? new ?OutputStreamWriter(dos);
          ????????????output.write(Query);
          ????????????output.flush();
          ????????????dos.close();
          ????????????output.close();
          ????????????urlconn.getInputStream();

            今天上午在這段代碼里面,有個(gè)地方讓我郁悶了。對了targeturl的值是指向了一個(gè)actinon(struts相關(guān))。而此action是extends DispatchAction。
          到了urlconn.getInputStream();中,顯然要觸發(fā)urlconn。也就是上面的action了。然后不懂的是它竟然觸發(fā)了此action中的update方法,郁悶ing...中。為什么偏偏觸發(fā)它呢?原來,update方法是由unspecified所引用,

          ??public?ActionForward?unspecified(ActionMapping?mapping,?ActionForm?form,
          ????????????HttpServletRequest?request,?HttpServletResponse?response)?
          {
          ????????
          return?update(mapping,?form,?request,?response);
          ????}

            而上述代碼中顯示沒有指定method,so it will acive the default method(unspecified) which defined in struts .In struts it defined in org.apache.struts.actions.DispatchAction .

            
          that is why the codes active the update method !
            if you see the problem in another style , it will be bring another effect to u !
          posted on 2006-05-11 12:30 Jkallen 閱讀(1821) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 柘荣县| 洛隆县| 怀柔区| 邹平县| 汪清县| 丰顺县| 辛集市| 恩平市| 鄂尔多斯市| 城口县| 鄯善县| 梧州市| 洛隆县| 永和县| 南平市| 北票市| 航空| 石景山区| 南靖县| 滦平县| 鄂温| 拉孜县| 姚安县| 龙泉市| 改则县| 青川县| 徐汇区| 武鸣县| 海兴县| 湘阴县| 广平县| 义马市| 洱源县| 芮城县| 玉山县| 临桂县| 长寿区| 巫溪县| 荔浦县| 贵州省| 望谟县|