wake

          2006年8月23日 #

          sun.io.MalformedInputException at sun.io.ByteToCharGB18030.convert

          此錯(cuò)誤讓我及其郁悶:搞了一整天帶一加班,終于解決了,但具體為什么就不知道了...

          問(wèn)題描述:當(dāng)初同事的開(kāi)發(fā)環(huán)境為:jsp+struts+hibernate+tomcat5.0+jdk1.4.1,后來(lái)因?yàn)闄C(jī)器頻繁死機(jī),所以想換成WEBSPHERE平臺(tái)...接著就出現(xiàn)了以下錯(cuò)誤:

          sun.io.MalformedInputException?at sun.io.ByteToCharGB18030.convert(ByteToCharGB18030.java(Compiled Code))?at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java(Inlined Compiled Code))?at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java(Compiled Code))?at sun.nio.cs.StreamDecoder.read(StreamDecoder.java(Compiled Code))?at java.io.InputStreamReader.read

          省略....

          解決方法:
          1,其中有些頁(yè)面是JS的問(wèn)題,去掉就可以了,但為什么???

          < script?language = " JavaScript " > ?
          <!-- ?
          var?flag
          = false ;?
          function?DrawImage(ImgD)
          {?
          var?image
          = new ?Image();?
          image.src
          = ImgD.src;?
          if (image.width > 0 ? && ?image.height > 0 ) {?
          flag
          = true ;?
          if (image.width / image.height >= ? 100 / 80 ) {?
          if (image.width > 100 ) {?
          ImgD.width
          = 100 ;?
          ImgD.height
          = (image.height * 80 ) / image.width;?
          }
          else {?
          ImgD.width
          = image.width;?
          ImgD.height
          = image.height;?
          }
          ?
          ImgD.alt
          = image.width + " ?+image.height;?
          }
          ?
          else {?
          if (image.height > 80 ) {?
          ImgD.height
          = 80 ;?
          ImgD.width
          = (image.width * 80 ) / image.height;?
          }
          else {?
          ImgD.width
          = image.width;?
          ImgD.height
          = image.height;?
          }
          ?
          ImgD.alt
          = image.width + " ?+image.height;?
          }
          ?
          }
          ?
          }
          ?
          // -->?
          </ script >

          2,原來(lái)的部分JSP頁(yè)面是這樣
          <%@ page language="java" pageEncoding="UTF-8"%>
          改為:
          <%@ page language="java" pageEncoding="GBK">? 就可以了。這個(gè)原因是因?yàn)槠渲邪?yè)面定義的編碼為GBK。
          3,部分頁(yè)面經(jīng)過(guò)以上改動(dòng)還是不行,我換成
          <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" %> 就可以了。

          問(wèn)題總算解決,但部分原因不明,亂七八糟的改了那些東西,等有時(shí)間再仔細(xì)研究研究...

          posted @ 2006-11-08 16:45 wake 閱讀(5899) | 評(píng)論 (2)編輯 收藏

          可能是JAVA中最簡(jiǎn)單的計(jì)算百分比方法。。。

          前兩天在項(xiàng)目中用到的...

          ???? /**
          ?????*?獲取百分比
          ?????*?
          ?????*?
          @param ?p1
          ?????*?
          @param ?p2
          ?????*?
          @return
          ?????
          */

          ????
          public ? static ?String?percent( double ?p1,? double ?p2)? {
          ????????String?str;
          ????????
          double ?p3? = ?p1? / ?p2;
          ????????NumberFormat?nf?
          = ?NumberFormat.getPercentInstance();
          ????????nf.setMinimumFractionDigits(
          2 );
          ????????str?
          = ?nf.format(p3);
          ????????
          return ?str;
          ????}

          posted @ 2006-09-05 16:18 wake 閱讀(9926) | 評(píng)論 (1)編輯 收藏

          eclipse中JS中文亂碼解決...



          可依次選擇"window">>"preferences">>"general">>"content types"

          在右邊的窗口中打開(kāi)列表,選中"JavaScript",在下面的"default encoding"右邊的輸入框中輸入"GBK"或"GB2312"再點(diǎn)"update"按鈕,再打開(kāi)JS文件就可以

          如果沒(méi)有提供選擇向,在下面的“文件關(guān)聯(lián)”中添加一個(gè)“*.js”,然后指定編碼為"GBK"或"GB2312"就可以了

          posted @ 2006-08-23 16:04 wake 閱讀(5183) | 評(píng)論 (3)編輯 收藏

          主站蜘蛛池模板: 石棉县| 海伦市| 吉水县| 茂名市| 额尔古纳市| 岗巴县| 杭锦后旗| 韩城市| 孝感市| 普格县| 富顺县| 仁化县| 抚松县| 莲花县| 焉耆| 榆林市| 连平县| 务川| 株洲县| 盘锦市| 靖西县| 涞水县| 南昌县| 大姚县| 饶阳县| 抚州市| 沙洋县| 大足县| 彭山县| 巴青县| 称多县| 柯坪县| 西吉县| 富平县| 三原县| 林州市| 灌南县| 西宁市| 邻水| 林口县| 循化|