从webservice里读取出来的数据到XML中进行更改(就是将一个字符串转换成对应的中文)在JSP上显示出来的时候都是乱码???网上搜了一堆方法,都是不行有没有高人指导一下?
这个是JSP读取XML的代码<% 
     //读取站点信息配置文件 
     PrintWriter printWriter = response.getWriter(); 
     //request.setCharacterEncoding("gb2312");
     response.setCharacterEncoding("gb2312"); 
     String stationName = null; 
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 
     DocumentBuilder db = dbf.newDocumentBuilder(); 
 
     InputStream is = new FileInputStream("D:\\workspace\\Information_Share_Platform_Develop\\WebRoot\\WEB-INF\\StationNumInfo.xml"); 
      
     Document document = db.parse(is); 
 
     XPathFactory xpf = XPathFactory.newInstance(); 
     XPath xp = xpf.newXPath(); 
      
      
     //获取action传递过来的字符串 
     String str = (String)request.getAttribute("result");
            
     String[] result1 = str.split("\\|"); 
     for(int i=0;i< result1.length;i++){ 
String[] num = result1[i].split(" "); 
       //for(int k=0;k<num.length;k++){
      
     //将站点信息改为中文 
     String xmlPath = "//station[value='"+num[0]+"']/name/text()"; 
     XPathExpression expr = xp.compile(xmlPath); 
 
     Object result = expr.evaluate(document, XPathConstants.NODESET); 
     NodeList nodes = (NodeList) result; 
     for (int j = 0; j < nodes.getLength(); j++) { 
     stationName = nodes.item(j).getNodeValue(); 
     //stationName   =   new   String(stationName.getBytes("GB2312")); 
     printWriter.print(stationName+":"+result1[i]); 
     printWriter.print("<br/>"); 
    
      }
      //}
       
      } 
xml的代码
<?xml version="1.0" encoding="GB2312"?>
<StationNum>
<station>
<value>1234</value>
<name>好</name>
</station></StationNum>