All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
Ajax开发过程中提交获取数据的乱码问题_[AJAX教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/3/16 2:52:13 Browse times: 323 Comment times: 0

Ajax开发过程中提交获取数据的乱码问题_[AJAX教程]


Head photo

Go homepage
Upload pictures
Write articles

Ajax开发过程中提交获取数据的乱码问题_[AJAX教程]























通过在后台用UTF8转码的方式可以解决中文乱码问题。这种方法针对form表单提交,编码在服务器完成。代码如下:




form.jsp:
<%@ page contentType="text/html; charset=gb2312"%>



表单提交测试












用户名:















密码:





























form_handle.jsp:
<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %>
<%
String username = new String(request.getParameter("username").getBytes("ISO-8859-1"),"UTF8");
String password = request.getParameter("password");
System.out.println("用户名:"+username);
System.out.println("密码:"+password);
out.println(username+"|"+password);
%>

来源:http://blog.csdn.net/javatwt











































There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.