<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)  編輯  收藏

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


    網站導航:
     
    主站蜘蛛池模板: 亚洲videos| 亚洲综合激情九月婷婷| 97无码人妻福利免费公开在线视频| 亚洲最大AV网站在线观看| 三年片在线观看免费观看大全一| 亚洲videos| 亚洲AV中文无码乱人伦下载| 成年男女男精品免费视频网站| 又长又大又粗又硬3p免费视频| 久久久久亚洲AV片无码下载蜜桃 | 国产成人精品免费视频动漫| jizzjizz亚洲日本少妇| 亚洲国产人成网站在线电影动漫| 啦啦啦在线免费视频| 国产好大好硬好爽免费不卡| 亚洲第一综合天堂另类专| 亚洲AV永久纯肉无码精品动漫| 日韩免费视频播播| 7x7x7x免费在线观看| 无忧传媒视频免费观看入口| 91亚洲自偷在线观看国产馆| 亚洲无线观看国产精品| 好爽又高潮了毛片免费下载 | 日日AV拍夜夜添久久免费| 美女视频黄的免费视频网页 | 中文字幕在线观看免费| 亚洲色大成网站www| 亚洲视频在线观看免费| 国产乱辈通伦影片在线播放亚洲| 四虎永久在线精品免费网址| 日韩免费无码视频一区二区三区| selaoban在线视频免费精品| 亚洲AV无码一区二区三区久久精品 | 97免费人妻在线视频| 久久久精品国产亚洲成人满18免费网站 | 激情97综合亚洲色婷婷五| 国内精品免费视频自在线| 91久久成人免费| 久久免费动漫品精老司机| 中文字幕a∨在线乱码免费看| 无码天堂va亚洲va在线va|