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

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


    網站導航:
     
    主站蜘蛛池模板: 亚洲免费在线视频播放| 亚洲欧洲在线观看| 日韩国产欧美亚洲v片| 特级做A爰片毛片免费69| 亚洲另类精品xxxx人妖| 老司机在线免费视频| 亚洲人成高清在线播放| 中文字幕影片免费在线观看| ass亚洲**毛茸茸pics| 亚洲精品免费网站| 亚洲人成网站999久久久综合| 免费观看的a级毛片的网站| 精品成人一区二区三区免费视频| 人人狠狠综合久久亚洲高清| 一个人晚上在线观看的免费视频| 女bbbbxxxx另类亚洲| 四虎永久在线精品免费影视| jizz在线免费观看| 亚洲av日韩av无码| 免费无码又爽又刺激聊天APP| 无码天堂亚洲国产AV| 亚洲爽爽一区二区三区| 无码人妻一区二区三区免费看| 日韩亚洲AV无码一区二区不卡| 无码免费午夜福利片在线| 亚洲第一se情网站| 亚洲精品狼友在线播放| 在线看片韩国免费人成视频| 亚洲精品国产首次亮相| 精品亚洲视频在线观看| aⅴ免费在线观看| 日韩在线视频播放免费视频完整版| 国产亚洲综合色就色| 免费电影在线观看网站| 一进一出60分钟免费视频| 亚洲综合色丁香麻豆| 免费在线观看亚洲| 亚洲一区二区免费视频| 美国免费高清一级毛片| 亚洲一区免费视频| 亚洲熟妇无码乱子AV电影|