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

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

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

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

    導(dǎo)航

    隨筆分類(86)

    隨筆檔案(85)

    搜索

    •  

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

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

    redirect 會(huì)首先發(fā)一個(gè)response給瀏覽器, 然后瀏覽器收到這個(gè)response后再發(fā)一個(gè)requeset給服務(wù)器, 然后服務(wù)器發(fā)新的response給瀏覽器. 這時(shí)頁面收到的request是一個(gè)新從瀏覽器發(fā)來的.

    forward 發(fā)生在服務(wù)器內(nèi)部, 在瀏覽器完全不知情的情況下發(fā)給了瀏覽器另外一個(gè)頁面的response. 這時(shí)頁面收到的request不是從瀏覽器直接發(fā)來了,可能己經(jīng)放了數(shù)據(jù).

    所以:
    request.setAttribute存的東西

    只用通過方法2跳轉(zhuǎn) 才能在新頁取出來
    用 DecimalFormat 格式化數(shù)字 引言 Java中對(duì)浮點(diǎn)數(shù)的輸出表示 在Java中浮點(diǎn)數(shù)包括基本型float、double,以及對(duì)象包裝類型的Float和Double,對(duì)于這些浮點(diǎn)數(shù)的輸出,不管是顯式地還是隱式地調(diào)用toString()得到它的表示字串,輸出格式都是按照如下規(guī)則進(jìn)行的 如果絕對(duì)值大于0.001、小于10000000,那么就以常規(guī)的小數(shù)形式表示。 如果在上述范圍之外,則使用科學(xué)計(jì)數(shù)法表示。即類似于1.234E8的形式。 可以使用 java.text.DecimalFormat及其父類NumberFormat格式化數(shù)字 本例只淺述DecimalFormat的使用。 Pattern 0 - 如果對(duì)應(yīng)位置上沒有數(shù)字,則用零代替 # - 如果對(duì)應(yīng)位置上沒有數(shù)字,則保持原樣(不用補(bǔ));如果最前、后為0,則保持為空。 正負(fù)數(shù)模板用分號(hào)(;)分割 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(逗號(hào)) is a placeholder for the grouping separator, and the period(句號(hào)) is a placeholder for the decimal separator. 井號(hào)(#)表示一位數(shù)字,逗號(hào)是用于分組分隔符的占位符,點(diǎn)是小數(shù)點(diǎn)的占位符。 如果小數(shù)點(diǎn)的右面,值有三位,但是式樣只有兩位。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 (#). 應(yīng)用實(shí)例 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 智者無疆 閱讀(3838) 評(píng)論(8)  編輯  收藏 所屬分類: about java
    評(píng)論:
     
    Copyright © 智者無疆 Powered by: 博客園 模板提供:滬江博客


       觀音菩薩贊

    主站蜘蛛池模板: 亚洲区视频在线观看| 国产成人啪精品视频免费网| 国产亚洲人成无码网在线观看 | 亚洲人成依人成综合网| 国产成人精品亚洲一区| 黄页网址大全免费观看12网站| 拔擦拔擦8x华人免费久久| 亚洲AV一区二区三区四区| 国产免费131美女视频| 白白色免费在线视频| 亚洲日韩中文在线精品第一| 又硬又粗又长又爽免费看| 亚洲深深色噜噜狠狠爱网站| 久久久久国产免费| 亚洲AV无码专区在线亚| 免费看又爽又黄禁片视频1000| 国产精品亚洲一区二区三区 | 国内精品一级毛片免费看| 久久香蕉国产线看观看亚洲片| 最近2019中文字幕免费直播| 热久久精品免费视频| 特级毛片在线大全免费播放| 久久亚洲国产欧洲精品一| 亚欧人成精品免费观看| 亚洲av日韩专区在线观看| 久久亚洲2019中文字幕| 69pao强力打造免费高清| 亚洲午夜无码久久久久| 久久w5ww成w人免费| 久久无码av亚洲精品色午夜| 色久悠悠婷婷综合在线亚洲| 四虎在线视频免费观看视频| 美女被免费视频网站a| 亚洲成人在线电影| 成人自慰女黄网站免费大全| 亚洲精品电影在线| 亚洲国产婷婷香蕉久久久久久| 久久久久久成人毛片免费看| 精品久久亚洲一级α| 亚洲精品私拍国产福利在线| 日本最新免费不卡二区在线|