post方式提交request.getParamter();乱码解决方法

首先要在doPost()方法里面注明编码request的编码方式:request.setCharacterEncoding("utf-8");或request.setCharacterEncoding("gbk");

如果还不行,就要给单独request的属性进行重新编码:例:String name= new String(request.getParameter("name").getBytes("ISO-8859-1"),"utf-8") ;

这样就可以了。



你可能感兴趣的:(post方式提交request.getParamter();乱码解决方法)