tomcat 中文问题 <%@ page contentType="text/html;charset=GBK" %> 不对吧,gb2312才对巴 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 使用url编码:<a href="test.jsp?name=<%=URLEncoder.encode(new String(str.getBytes("gb2312"),"iso8859-1"))%> hh23你的问题让人有点糊涂,其实应该是:1) index.jsp<html><head> <title>test1</title><head><body><%@ page contentType="text/html;charset=gb312" %> <% String str="中文"; %><% byte[] by= str.getBytes("GBK");%><% String s= new String(by);%><a href="test.jsp?name=<%=str%>">测试jsp的中文</a></body></html>2)test.jsp <%!String name;%> <% name=request.getParameter("name"); out.println(name); %> <% if (name==null)out.print("nothing"); else out.print(name); %> 结果test.jsp显示:??为什么name的值显示为?而不是"汉字"? 在URL中为test.jsp?name=汉字但在jsp程序中name=request.getParameter("name");out.println(name);显示为??有谁知道是什么问题? html中base标签时干什么的 关于LOG4J问题,来者有分 JSTL问题 我崩溃了~~~~求助 在firefox 下怎样给父窗口的text赋值 80分!求jsp远程连接access的代码 怎样使得JInternalFrame的初始大小是填满整个Jdesktoppane? tomcat的承受能力到底有多强? 如何在servlet中得到客户端的port(端口) Apache中web.xml文件怎么配置 JSP真的没有高手吗! 怪问题,看了可别骂我是猪啊! 问一个比较基础的问题,JSP、ASP以及JavaScript的区别及各自的优缺点?
<a href="test.jsp?name=<%=URLEncoder.encode(new String(str.getBytes("gb2312"),"iso8859-1"))%>
1) index.jsp
<html>
<head>
<title>
test1
</title>
<head>
<body>
<%@ page contentType="text/html;charset=gb312" %>
<% String str="中文"; %>
<% byte[] by= str.getBytes("GBK");%>
<% String s= new String(by);%>
<a href="test.jsp?name=<%=str%>
">测试jsp的中文</a>
</body>
</html>2)test.jsp <%!String name;%>
<%
name=request.getParameter("name");
out.println(name);
%>
<%
if (name==null)
out.print("nothing");
else out.print(name);
%>
结果test.jsp显示:
??
为什么name的值显示为?而不是"汉字"?
但在jsp程序中
name=request.getParameter("name");
out.println(name);
显示为??有谁知道是什么问题?