url中的中文先转码下 再传递

解决方案 »

  1.   

    希望不是太晚/*
     * Created on Sep 26,2008
     * 
     * Copyright by 布谷鸟
     */
    package encode;import java.util.StringTokenizer;/**
     * 
     * @Author <a href="[email protected]">cuckoo</a>
     * @Time 14:14
     * @Description 转换编码
     */
    public class TransferEncode { public static void main(String args[]) {
    String str = "&#24067;&#35895;&#40479";
    System.out.println("--"+unicode2String(str));
    } private static String unicode2String(String unicode){  
    StringBuffer buff = new StringBuffer();      
    StringTokenizer token = new StringTokenizer(unicode,";");      
    String temp = null;
    String newTemp = null;
    while(token.hasMoreTokens()){
    temp = token.nextElement().toString();
    newTemp = temp.replaceAll("&#", "");         
    buff.append((char)Integer.parseInt(newTemp, 10));   
    }
    return buff.toString();
    }
    }
    ------------------------------------------------------
    Quietly through....
      

  2.   

    我用的是strust2标签显示的 你这个怎么使用啊