JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Servlet/JSP 討論區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 request getParameter 中文亂碼
honienglon





發文: 59
積分: 0
於 2009-04-20 19:49 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Ajax part
1
2
3
4
5
6
7
8
9
function ajaxGetFlwDetial(list,selector)
  { 
    var url = "flowDetial?flowname="  + "你好";    
  
    createXmlHttpReq();          
    xmlHttpReq.onreadystatechange = handleStateChange;
    xmlHttpReq.open("GET",url,true);
    xmlHttpReq.send(null);
  }


servlet part
1
2
String flowname = new String(request.getParameter("flowname").getBytes("ISO-8859-1"),"UTF-8");  
System.out.println(flowname + "=========");


在System console 得出亂碼 ?q????=========

請問如何解決呀?


reply to postreply to post
作者 Re:request getParameter 中文亂碼 [Re:honienglon]
caterpillar

良葛格

版主

發文: 2587
積分: 70
於 2009-04-20 20:25 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
你的Console可以顯示UTF-8嗎?。。。XD

reply to postreply to post
良葛格學習筆記
CodeData 專欄
作者 Re:request getParameter 中文亂碼 [Re:caterpillar]
honienglon





發文: 59
積分: 0
於 2009-04-20 21:40 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
caterpillar wrote:
你的Console可以顯示UTF-8嗎?。。。XD


可以!!!

不過我已把問題解決了, 我把Ajax 換用 POST 方式, 並設定
1
 xmlHttpReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded;")


但新一個問題又出現, 假設我有二個 tab page , 我在tab page one 中用ajax把mysql中的data取出來顯示,但當我在tab page two做insert database 之後,再到tab page one 重新取回data時,不能顯示新增的record, 要把 IE 關掉 再重新開啓 IE 才能看到所有data


reply to postreply to post
作者 Re:request getParameter 中文亂碼 [Re:honienglon]
Zippo朱雀





發文: 21
積分: 0
於 2009-04-21 10:25 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
不知道這篇對您有沒有幫助
http://topic.csdn.net/t/20021104/15/1147152.html


reply to postreply to post
在未學習前,覺得自己要學的東西跟山一樣高

學習後,赫然發現自己要學的東西比山還要高

If you never try, you’ll never know.
» JWorld@TW »  Servlet/JSP 討論區

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8