登录 用户中心() [退出] 后台管理 注册
   
您的位置: 首页 >> 程序员学前班[不再更新,只读] >> 主题: [java/jsp] jsp中关于request.getParameter中文的乱码问题     [回主站]     [分站链接]
标题
[java/jsp] jsp中关于request.getParameter中文的乱码问题
clq
浏览(0) + 2008-11-17 09:51:01 发表 编辑

关键字:

jsp中关于request.getParameter中文的乱码问题

<%@ page contentType="text/html;charset=gbk" %>

<br /> <%<br /> request.setCharacterEncoding("GBK");//设置编码格式为中文<br /> String title = request.getParameter("title");<br /> out.print(title);<br /> %><br />

clq
2008-11-17 9:51:36 发表 编辑

下面这样也可以,不过要注意提交方法为 post.

<%@page contentType="text/html; charset=GBK"%>


jsp_test1


JBuilder Generated JSP

















<%
try
{
//request.setCharacterEncoding("GBK");//设置编码格式为中文
String s = new String(request.getParameter("text").getBytes("ISO8859-1"), "GBK");
//String s = request.getParameter("text");
out.print(s);
}catch(Exception e)
{
e.printStackTrace();
}
%>






总数:1 页次:1/1 首页 尾页  
总数:1 页次:1/1 首页 尾页  


所在合集/目录



发表评论:
文本/html模式切换 插入图片 文本/html模式切换


附件:



NEWBT官方QQ群1: 276678893
可求档连环画,漫画;询问文本处理大师等软件使用技巧;求档softhub软件下载及使用技巧.
但不可"开车",严禁国家敏感话题,不可求档涉及版权的文档软件.
验证问题说明申请入群原因即可.

Copyright © 2005-2020 clq, All Rights Reserved
版权所有
桂ICP备15002303号-1