日期:2014-05-20  浏览次数:20787 次

Servlet读取wml参数中文乱码问题
Servlet在读取参数时,如果参数是中文则不能正常显示,谁能帮一下吗,谢谢

文件index.wml
<?xml   version= "1.0 "?>
<!DOCTYPE   wml   PUBLIC   "-//WAPFORUM//DTD   WML   1.1//EN "   "http://www.wapforum.org/DTD/wml_1.1.xml ">
<wml>
<card   id= "index "   title= "test ">
<p>
<input   type= "text "   name= "name "/>
</p>
<do   type= "accept "   label= "test "   >
<go   href= "http://211.80.59.116:8080/encoding/Server "   method= "get ">
<postfield   name= "name "   value= "$(name) "/>
</go>
</do>
</card>
</wml>

Servlet文件
import   java.io.*;
import   javax.servlet.*;
import   javax.servlet.http.*;

public   class   Server   extends   HttpServlet
{
public   void   doGet(HttpServletRequest   req,HttpServletResponse   res)throws   IOException,ServletException
{
String   input=(String)req.getParameter( "name ");
System.out.println(input);
}
}


------解决方案--------------------
中文问题每天都有新帖,都不知道搜索