<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Bryan

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      37 Posts :: 3 Stories :: 24 Comments :: 0 Trackbacks

    最近在做的一個項目,前臺依然是使用displaytag,由于項目需要,需要對記錄進行排序和導出報表,因為數據不允許分頁,提交過來的參數信息又較多,所以在Displaytag中,默認取request中的數據再次導出報表和排序,就導致URL 過長,導致導出和排序失敗.

    WWW FAQs: What is the maximum length of a URL?

    2006-10-13: Although the specification of the HTTP protocol does not specify any maximum length, practical limits are imposed by web browser and server software.

    Microsoft Internet Explorer (Browser)

    Microsoft states that the maximum length of a URL in Internet Explorer is 2,083 characters, with no more than 2,048 characters in the path portion of the URL. In my tests, attempts to use URLs longer than this produced a clear error message in Internet Explorer.

    Firefox (Browser)

    After 65,536 characters, the location bar no longer displays the URL in Windows Firefox 1.5.x. However, longer URLs will work. I stopped testing after 100,000 characters.

    Safari (Browser)

    At least 80,000 characters will work. I stopped testing after 80,000 characters.

    Opera (Browser)

    At least 190,000 characters will work. I stopped testing after 190,000 characters. Opera 9 for Windows continued to display a fully editable, copyable and pasteable URL in the location bar even at 190,000 characters.

    在其他的瀏覽器都正常.因為DisplayTag在處理導出報表和排序默認是Get處理請求的,沒辦法,到google搜了一下,發現有人解決了這個問題.見(http://jira.codehaus.org/browse/DISPL-377)

    試著修改這個類,,因為處理為Form Post提交數據,一切正常.但是想想source code被修改了,會給以后帶來一定的風險.想個1天也沒什么辦法.感覺只能post才能處理大量的數據.

    postForm.append("<form name=\"form" + uid
           + "\" method=\"post\" action=\""
           + sortHref.getBaseUrl() + "\">");
         for (int idx = 0; idx < mapKey.length; idx++) {
          String value = "";
          // Modified by Indicia 07-mar-2007 - Begin
          if (sortHref.getParameterMap().get(mapKey[idx]) instanceof Object[]) {
           Object[] values = (Object[])sortHref.getParameterMap().get(mapKey[idx]);
           for(int j=0; j < values.length; j++) {
            value = ((Object)values[j]).toString();
            try {
             postForm.append("<input type=\"hidden\" name=\""
               + mapKey[idx] + "\" value=\"" + URLDecoder.decode(value, "ISO-8859-1") + "\">");
            } catch (UnsupportedEncodingException ignore) {}
           }
          } else {
           value = sortHref.getParameterMap().get(
             mapKey[idx]).toString();
           try {
            postForm.append("<input type=\"hidden\" name=\""
              + mapKey[idx] + "\" value=\"" + URLDecoder.decode(value, "ISO-8859-1") + "\" title=\""+value+"\"/>");
           } catch (UnsupportedEncodingException ignore) {}
          }      
          // Modified by Indicia 07-mar-2007 - End
         }
         postForm.append("</form>");
         Href postExportHerf = (Href) sortHref.clone();
         postExportHerf.setFullUrl("javascript:document.forms['form" + uid
           + "'].submit();");

    本來想這個樣子,反正解決了問題,但是想想,好象默認的Session中的數據不會出現在displaytagUrl后面,就試著改了下代碼,發現果然可行.把較長的數據放在session中,然后在displaytag前臺中使用excludedParams="datasubmit去除那些需要長的需要再次提交給后臺的數據.結果發現果然導出報表和排序正常了.

      //first get it from request
      //if is null get from the session
      String dataSubmit=request.getParameter("datasubmit");
      if(dataSubmit==null)
      {
           dataSubmit=(String)request.getSession().getAttribute("datasubmit");
      }
      
      request.getSession().setAttribute("datasubmit", dataSubmit);

    <display:table name="states" sort="list" defaultsort="1" id="element" requestURI="state.html"  excludedParams="datasubmit">
      <display:column property="id" title="ID" sortable="true" sortName="id" />
      <display:column property="country_id" sortable="true" sortName="country_id" title="First Name" />
    </display:table>

    posted on 2008-06-09 10:34 Life is no respector of any genius. 閱讀(812) 評論(0)  編輯  收藏

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


    網站導航:
     
    主站蜘蛛池模板: 亚洲va中文字幕无码| 免费看大美女大黄大色| jizz免费观看视频| 免费无遮挡无码永久在线观看视频| 亚洲一卡2卡3卡4卡国产网站| 18以下岁毛片在免费播放| 日本一道一区二区免费看| 亚洲av无码一区二区乱子伦as| 亚洲欧洲无卡二区视頻| 免费无码又爽又刺激一高潮| 国产美女在线精品免费观看| 亚洲第一区精品观看| 一级视频在线免费观看| 国产精品视频免费一区二区| 亚洲色大成网站www久久九| 久久国产精品免费视频| 久久99亚洲网美利坚合众国| 午夜宅男在线永久免费观看网| 久久亚洲国产伦理| 亚洲人成免费网站| 亚洲av无码专区在线电影天堂| 免费在线观看理论片| a级毛片免费全部播放| 亚洲国产精品人人做人人爽| 香蕉免费在线视频| 亚洲精品亚洲人成在线观看下载| 久久国产亚洲精品| 夜色阁亚洲一区二区三区| 中文字幕永久免费| 亚洲国产美女视频| 免费很黄很色裸乳在线观看| 中文字幕av免费专区| 亚洲国产精品成人综合色在线婷婷| 日韩精品无码区免费专区| 老司机免费午夜精品视频| 成年性午夜免费视频网站不卡| 亚洲国产精品自在线一区二区| 在线观看AV片永久免费| 好吊色永久免费视频大全| 亚洲春色另类小说| 亚洲国产成人久久综合一区77 |