摘要: GET: 1 public static String loginByGet(String username,String password){ 2 try { 3 //定义路径 4 String path="http://192.168.1.102:8084/androidServer/loginServlet?username=" 5 +URLEncoder.encode(URLEncoder.encode(username,"UTF-8"), "UTF-8")+"&password="... 阅读全文
posted @ 2013-11-07 22:22 忘语 阅读(695) 评论(0) 推荐(0) 编辑
摘要: 方案一:GET:POST对于中文字段,客户端使用URLEncoder.encode()方法进行一次编码服务器使用:String data=new String(request.getParameter("title").getBytes("ISO-8859-1"),"UTF-8");解码个人觉得这种方法挺麻烦的,喜欢采用方案二方案二:GET:客户端使用URLEncoder.encode(URLEncoder.encode(username,"UTF-8"), "UTF-8")对中文字段进行两次编 阅读全文
posted @ 2013-11-07 21:27 忘语 阅读(981) 评论(0) 推荐(0) 编辑