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

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

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

    軟件藝術思考者  
    混沌,彷徨,立志,蓄勢...
    公告
    日歷
    <2007年8月>
    2930311234
    567891011
    12131415161718
    19202122232425
    2627282930311
    2345678

    導航

    隨筆分類(86)

    隨筆檔案(85)

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

     
    使用response.sendRedirect()地址欄將改變
    使用request.getRequestDispatcher().forward(request,response)地址欄中的信息保持不變只用通過方法2跳轉 才能在新頁取出來

    redirect 會首先發一個response給瀏覽器, 然后瀏覽器收到這個response后再發一個requeset給服務器, 然后服務器發新的response給瀏覽器. 這時頁面收到的request是一個新從瀏覽器發來的.

    forward 發生在服務器內部, 在瀏覽器完全不知情的情況下發給了瀏覽器另外一個頁面的response. 這時頁面收到的request不是從瀏覽器直接發來了,可能己經放了數據.

    所以:
    request.setAttribute存的東西

    只用通過方法2跳轉 才能在新頁取出來
    用 DecimalFormat 格式化數字 引言 Java中對浮點數的輸出表示 在Java中浮點數包括基本型float、double,以及對象包裝類型的Float和Double,對于這些浮點數的輸出,不管是顯式地還是隱式地調用toString()得到它的表示字串,輸出格式都是按照如下規則進行的 如果絕對值大于0.001、小于10000000,那么就以常規的小數形式表示。 如果在上述范圍之外,則使用科學計數法表示。即類似于1.234E8的形式。 可以使用 java.text.DecimalFormat及其父類NumberFormat格式化數字 本例只淺述DecimalFormat的使用。 Pattern 0 - 如果對應位置上沒有數字,則用零代替 # - 如果對應位置上沒有數字,則保持原樣(不用補);如果最前、后為0,則保持為空。 正負數模板用分號(;)分割 Number Format Pattern Syntax You can design your own format patterns for numbers by following the rules specified by the following BNF diagram: pattern := subpattern{;subpattern} subpattern := {prefix}integer{.fraction}{suffix} prefix := '\\u0000'..'\\uFFFD' - specialCharacters suffix := '\\u0000'..'\\uFFFD' - specialCharacters integer := '#'* '0'* '0' fraction := '0'* '#'* DEMO value 123456.789 pattern ,###.### output 123,456.789 Explanation The pound sign (#) denotes a digit, the comma(逗號) is a placeholder for the grouping separator, and the period(句號) is a placeholder for the decimal separator. 井號(#)表示一位數字,逗號是用于分組分隔符的占位符,點是小數點的占位符。 如果小數點的右面,值有三位,但是式樣只有兩位。format方法通過四舍五入處理。 value 123.78 pattern 000000.000 output 000123.780 Explanation The pattern specifies leading and trailing zeros, because the 0 character is used instead of the pound sign (#). 應用實例 1: /* * Copyright (c) 1995-1998 Sun Microsystems, Inc. All Rights Reserved. */ import java.util.*; import java.text.*; public class DecimalFormatDemo { static public void customFormat(String pattern, double value ) { DecimalFormat myFormatter = new DecimalFormat(pattern); String output = myFormatter.format(value); System.out.println(value + " " + pattern + " " + output); } static public void localizedFormat(String pattern, double value, Locale loc ) { NumberFormat nf = NumberFormat.getNumberInstance(loc); DecimalFormat df = (DecimalFormat)nf; df.applyPattern(pattern); String output = df.format(value); System.out.println(pattern + " " + output + " " + loc.toString()); } static public void main(String[] args) { customFormat("###,###.###", 123456.789); customFormat("###.##", 123456.789); customFormat("000000.000", 123.78); customFormat("$###,###.###", 12345.67); customFormat("\u00a5###,###.###", 12345.67); Locale currentLocale = new Locale("en", "US"); DecimalFormatSymbols unusualSymbols = new DecimalFormatSymbols(currentLocale); unusualSymbols.setDecimalSeparator('|'); unusualSymbols.setGroupingSeparator('^'); String strange = "#,##0.###"; DecimalFormat weirdFormatter = new DecimalFormat(strange, unusualSymbols); weirdFormatter.setGroupingSize(4); String bizarre = weirdFormatter.format(12345.678); System.out.println(bizarre); Locale[] locales = { new Locale("en", "US"), new Locale("de", "DE"), new Locale("fr", "FR") }; for (int i = 0; i posted on 2007-08-03 10:01 智者無疆 閱讀(3826) 評論(8)  編輯  收藏 所屬分類: about java
    評論:
    • # re: java:redirect 和forward的區別,DecimalFormat及DecimalFormat的使用  智者無疆 Posted @ 2007-08-03 10:23
      about forward:在服務器端,用request.getPrameter得不到forward的URL中加入的參數.因為在瀏覽器的地址欄里根本不會顯示URL,服務器要想用getPramater得到參數只能用redirect:這樣,服務器先向瀏覽器返回一個response,順帶著也把URL顯示到地址欄里了.然后再發送到服務器端.  回復  更多評論   

    • # re: java:redirect 和forward的區別,DecimalFormat及DecimalFormat的使用  myself Posted @ 2007-08-03 16:25
      //截取字符串中英文都轉成字符型
      public String substring(String str, int toCount) {
      int reInt = 0;
      String reStr = "";
      if (str == null) return "";
      char[] tempChar = str.toCharArray();
      for (int kk = 0; (kk < tempChar.length && toCount > reInt); kk++) {
      String s1 = str.valueOf(tempChar[kk]);
      byte[] b = s1.getBytes();
      reInt += b.length;
      reStr += tempChar[kk];
      }

      return reStr;
      }  回復  更多評論   

    • # re: java:redirect 和forward的區別,DecimalFormat及DecimalFormat的使用  zhanglijun Posted @ 2007-08-15 19:59
      http://community.csdn.net/Expert/topic/5678/5678786.xml?temp=.434704  回復  更多評論   

    • # re: java:redirect 和forward的區別,DecimalFormat及DecimalFormat的使用[未登錄]  lijun Posted @ 2007-08-17 16:14
      hibernate調用存儲過程
      http://youlong05.javaeye.com/blog/24870
      xiansheng(劉憲生) 16:02:40
      http://tech.it168.com/j/2006-05-30/200605301146190.shtml
      http://www.fish888.com/Hibernate-t144218  回復  更多評論   

    • # re: java:redirect 和forward的區別,DecimalFormat及DecimalFormat的使用[未登錄]  lijun Posted @ 2007-08-17 16:18
      http://blog.sina.com.cn/s/blog_415bd707010007zo.html
      CallableStatement cstmt = session.connection().prepareCall("{call pro_orderArticle(?, ?, ?, ?)}");
      cstmt.setInt(1, nodeId);
      cstmt.setString(2, oldOrderPath);
      cstmt.setString(3, orderPath);
      cstmt.setString(4, parentPath);
      try {
      cstmt.execute();
      } finally {
      cstmt.close();
      }  回復  更多評論   

    • # re: java:redirect 和forward的區別,DecimalFormat及DecimalFormat的使用[未登錄]  lijun Posted @ 2007-08-17 18:44

      DROP PROCEDURE IF EXISTS vonibo_demo.test;

      CREATE PROCEDURE vonibo_demo.test
      BEGIN
      DECLARE userid int default 1;
      DECLARE stopFlag int default 0;
      DECLARE cursor_name CURSOR
      FOR select user_id from wb_product where product_id=1;
      DECLARE CONTINUE HANDLER FOR NOT FOUND set stopFlag=1;
      OPEN cursor_name;
      REPEAT

      FETCH cursor_name INTO userid;
      select * from wb_user where user_id=1;
      UNTIL stopFlag=1 END REPEAT;

      CLOSE cursor_name;
      END;
        回復  更多評論   

    • # lucene的使用及優化  zhanglijun Posted @ 2008-03-16 22:10
      http://zhan.cn.yahoo.com/articles/071128/47031_40.html  回復  更多評論   

    • # lucene的學習資源  zhanglijun Posted @ 2008-03-18 14:10
      Lucene學習資源
      1.基于Java的全文索引引擎Lucene簡介
      http://www.chedong.com/tech/lucene.html
      2.Lucene中國
      http://www.lucene.com.cn/
      3.Lucene官方網站
      http://lucene.apache.org/
      4.Matrix論壇的Lucene版塊
      Lucene與搜索引擎技術


        回復  更多評論   

     
    Copyright © 智者無疆 Powered by: 博客園 模板提供:滬江博客


       觀音菩薩贊

    主站蜘蛛池模板: 91嫩草免费国产永久入口| 亚洲AV无码一区二区三区在线观看| 亚洲国产成人久久综合一区| 扒开双腿猛进入爽爽免费视频| 老外毛片免费视频播放| 久久精品国产亚洲AV麻豆~| 成人免费无码大片a毛片| 国产男女爽爽爽免费视频| 亚洲乱码中文字幕小综合| 亚洲日韩中文在线精品第一| 亚洲w码欧洲s码免费| 人成电影网在线观看免费| 亚洲第一成年网站大全亚洲| 亚洲第一永久AV网站久久精品男人的天堂AV | 亚洲中文字幕在线乱码| 18国产精品白浆在线观看免费 | 免费看搞黄视频网站| 亚洲欧美自偷自拍另类视| 久久精品亚洲日本佐佐木明希| 在线看片无码永久免费aⅴ| 久久99青青精品免费观看| 免费无码国产在线观国内自拍中文字幕 | 亚洲噜噜噜噜噜影院在线播放| 亚洲电影日韩精品| 西西大胆无码视频免费| 亚洲免费人成在线视频观看 | 亚洲av午夜电影在线观看| 亚洲精品无码不卡| 国产精品亚洲二区在线观看 | 成年性羞羞视频免费观看无限| 免费看成人AA片无码视频吃奶| 日韩成人精品日本亚洲| 亚洲av产在线精品亚洲第一站| 亚洲人成影院在线无码按摩店 | 国产精品亚洲专区在线观看 | 免费国产成人午夜电影| 在线观看免费人成视频色| 18级成人毛片免费观看| 国产裸体美女永久免费无遮挡| 亚洲AV无码成人精品区日韩| 亚洲一欧洲中文字幕在线|