中文问题:JDK131+JSERV+UNIX

killerdanny 2004-09-13 02:31:43
http://172.17.177.100:7778/webreport/eReport/cn16.jsp?nval=中问

//cn16.jsp
//想取得URL中nval的值,但是使用下列方法全是问号
//TOMCAT下某些方法正常
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.net.*"%>

<HTML>
<HEAD><TITLE>ASsSasa</TITLE></HEAD>
<body>
<p>政委<p>
<%!
public String getStr(String str)
{
String tem=null;
try{
String temp=str;
byte[] temd=temp.getBytes("gb2312");
tem=new String(temd,"ISO8859_1");

}
catch(Exception e)
{
System.err.println(e.getMessage());
}
return tem;
}
%>
<%
String s1=new String(request.getParameter("nval").getBytes(),"iso-8859-1");
out.println(s1);
String s2=new String(request.getParameter("nval").getBytes(),"gb2312");
out.println(s2);
String s3=new String(request.getParameter("nval").getBytes("iso-8859-1"),"gb2312");
out.println(s3);
String s4=new String(request.getParameter("nval").getBytes("gb2312"),"iso-8859-1");
out.println(s4);
String s5=new String(request.getParameter("nval").getBytes("iso-8859-1"));
out.println(s5);
String s6=new String(request.getParameter("nval").getBytes("gb2312"));
out.println(s6);

String s8=new String(URLDecoder.decode(request.getParameter("nval")));

out.println(s8);

String s9=new String(getStr(request.getParameter("nval")));

out.println(s9);

String s10=new String(request.getParameter("nval").getBytes("ISO8859-1"),"GBK");
out.println(s10);
out.println(request.getParameter("nval"));
%>
<%
String Hi="你好";
byte[]
tmpbyte=Hi.getBytes("ISO8859_1");
Hi=new
String(tmpbyte);
out.print(Hi);
%>
</body>
</html>
...全文
30 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
qukmei 2004-09-13
最好做一个过滤器吧
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2004-09-13 02:31
社区公告
暂无公告