wake

          My Links

          Blog Stats

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          2006年5月10日 #

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

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

          問題描述:當初同事的開發環境為:jsp+struts+hibernate+tomcat5.0+jdk1.4.1,后來因為機器頻繁死機,所以想換成WEBSPHERE平臺...接著就出現了以下錯誤:

          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,其中有些頁面是JS的問題,去掉就可以了,但為什么???

          < 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,原來的部分JSP頁面是這樣
          <%@ page language="java" pageEncoding="UTF-8"%>
          改為:
          <%@ page language="java" pageEncoding="GBK">? 就可以了。這個原因是因為其中包含頁面定義的編碼為GBK。
          3,部分頁面經過以上改動還是不行,我換成
          <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" %> 就可以了。

          問題總算解決,但部分原因不明,亂七八糟的改了那些東西,等有時間再仔細研究研究...

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

          可能是JAVA中最簡單的計算百分比方法。。。

          前兩天在項目中用到的...

          ???? /**
          ?????*?獲取百分比
          ?????*?
          ?????*?
          @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 閱讀(9933) | 評論 (1)編輯 收藏

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



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

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

          如果沒有提供選擇向,在下面的“文件關聯”中添加一個“*.js”,然后指定編碼為"GBK"或"GB2312"就可以了

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

          今天面試碰到的JAVA面試題...是最最基礎的...但我回答錯了...

          記不清具體的題目了....

          float f = 1.1;?? 這句編譯時會報錯?? 應該為 float f=(float)1.1 或者 float f=1.1F
          double d = 1.1;? 這句能夠正確編譯

          posted @ 2006-05-10 09:49 wake 閱讀(635) | 評論 (1)編輯 收藏

          主站蜘蛛池模板: 锡林浩特市| 怀柔区| 安化县| 滕州市| 龙里县| 章丘市| 沙田区| 武平县| 塔城市| 调兵山市| 泰安市| 凭祥市| 彝良县| 游戏| 阳城县| 苏尼特左旗| 苍溪县| 米脂县| 云梦县| 兴业县| 全州县| 湘潭县| 闻喜县| 阳泉市| 治多县| 河源市| 镇坪县| 柘荣县| 新竹市| 潜山县| 莫力| 博兴县| 肃北| 宝应县| 固始县| 华亭县| 龙井市| 巴南区| 云龙县| 屏东县| 内丘县|