jsp参数传递的乱马问题 jsp开头加一句<%@ page contentType="text/html; charset=GBK"%> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 接收参数的页:java.net.URLDecoder.decode(request.getParameter("参数名")); 1:在jsp页面加入: <%@ page contentType="text/html; charset=gb2312" %> 2:在servlet里面: public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html; charset=gb2312");//这是重要的 3:上面的如果在不行就用如下的方法在数据入库前进行调用: public static String UnicodeToChinese(String s){ try{ if(s==null ¦ ¦s.equals("")) return ""; String newstring=null; newstring=new String(s.getBytes("ISO8859_1"),"gb2312"); return newstring; } catch(UnsupportedEncodingException e) { return s; } } public static String ChineseToUnicode(String s){ try{ if(s==null ¦ ¦s.equals("")) return ""; String newstring=null; newstring=new String(s.getBytes("gb2312"),"ISO8859_1"); return newstring; } catch(UnsupportedEncodingException e) { return s; } } 解决页面的乱码:<%@ page language = "java" contentType = "text/html; charset=gb2312" %>解决参数传递<%String a=new String((request.getParameter("d7")).getBytes("ISO8859_1"));out.print(a);%>解决数据库参数类似 java读取js里面的<<符号问题 socke c/s文件传输 救命的!这段代码怎么改啊?能登陆,但是不能跳转!急急急!!! 我快疯了急!! 100分能帮我看看错在那了吗?顶者有分!!! 谁说说Java现在最前沿的技术有哪些?谢谢啦 Applet高级问题(高手进,解决即结帖) 大家帮我看看,这个项目值多少,我开价多少呢??? stucts的简单问题 jquery读取List集合中的一个元素,但只是获得第一个元素 在页面中给出提示信息的问题(大家帮帮忙!急) javabean的调用出错
java.net.URLDecoder.decode(request.getParameter("参数名"));
<%@ page contentType="text/html; charset=gb2312" %>
2:在servlet里面:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html; charset=gb2312");//这是重要的
3:上面的如果在不行就用如下的方法在数据入库前进行调用:
public static String UnicodeToChinese(String s){
try{
if(s==null ¦ ¦s.equals("")) return "";
String newstring=null;
newstring=new String(s.getBytes("ISO8859_1"),"gb2312");
return newstring;
}
catch(UnsupportedEncodingException e)
{
return s;
}
}
public static String ChineseToUnicode(String s){
try{
if(s==null ¦ ¦s.equals("")) return "";
String newstring=null;
newstring=new String(s.getBytes("gb2312"),"ISO8859_1");
return newstring;
}
catch(UnsupportedEncodingException e)
{
return s;
}
}
<%@ page
language = "java"
contentType = "text/html; charset=gb2312"
%>
解决参数传递<%
String a=new String((request.getParameter("d7")).getBytes("ISO8859_1"));
out.print(a);
%>
解决数据库参数类似