jsp乱码有关问题求解决jsp乱码有关问题求解决
jsp乱码问题求解决
我的jdk1.7 tomcat7.0
无论我怎么变换charset的只有post是中文,无论我怎样去掉三个charset设置,要么都不是中文,要么只有post方式是中文,
求帮助。
下面是测试程序
%@ page language= java contentType= text/html; charset=GB2312
pageEncoding= GB2312 %
%
request.setCharacterEncoding( GB2312 );
String...
jsp乱码有关问题求解决
jsp乱码问题求解决
我的jdk1.7 tomcat7.0
无论我怎么变换charset的只有post是中文,无论我怎样去掉三个charset设置,要么都不是中文,要么只有post方式是中文,
求帮助。
下面是测试程序
%@ page language= java contentType= text/html; charset=GB2312
pageEncoding= GB2312 %
%
request.setCharacterEncoding( GB2312 );
String action=request.getParameter( action );
if(action !=null action.trim().equals( action )){
String name=request.getParameter( name );
out.println(name);
System.out.println(name);
}
%
html
head
meta http-equiv= Content-Type content= text/html; charset=GB2312
title Insert title here /title
/head
body
form action= Test.jsp method= get
input type= hidden name= action value= action
table
tr
td
input type= text name= name value= 我是get
/td
td
input type= submit value= 提交get
/td
/tr
/table
/form
form action= Test.jsp method= post
input type= hidden name= action value= action
table
tr
td
input type= text name= name value= 我是post
/td
td
input type= submit value= 提交post
/td
/tr
/table
/form
a href= Test.jsp?action=action name=我是herf 我是href /a
/body
/html
------解决
--------------------------------------------------------
探讨
String name=request.getParameter( name );
加上这句 name=new String(name.getBytes( ISO-8859-1 ), gb23112 );
本文档为【jsp乱码有关问题求解决】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。