1、在另一个页面中这样得到数据String class2 = new String(request.getParameter("text").getBytes(
"ISO-8859-1"), "UTF-8");
2、设置第一个页面的method为post,第二页面头部有request.setCharacterEncoding("utf-8");
3、web.xml设置过滤器
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%request.setCharacterEncoding("utf-8");pageEncoding编码是UTF-8,所以要添加这段,就可以正常显示了
String path = request.getContextPath();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
</head>
<body>
<%
// String ss = new String(ss1.getBytes("UTF-8"),"GBK")
String content = request.getParameter("editor1");
if (content != null && !content.equals("")) {
out.println(content);
}
%>
<form name="testForm" method="post" action="<%=path%>/index.jsp">
<textarea cols="80" id="editor1" name="editor1" rows="10">
在此添加内容
</textarea>
<input type="submit" value="提交" />
</form>
</body>
</html>
不过最好是web.xml中统一编码,研究中。。。