在jsp输出中文
<%@page contentType="text/html;charset=utf-8"%>
or 在serverlet中
httprequest.setContentType("text/html;charset=utf-8")
<%
String str="中文";
byte[] temp =str.getBytes("ISO8859-1");
str= new String(temp);
out.print(str);
%>
<%@page contentType="text/html;charset=utf-8"%>
or 在serverlet中
httprequest.setContentType("text/html;charset=utf-8")
<%
String str="中文";
byte[] temp =str.getBytes("ISO8859-1");
str= new String(temp);
out.print(str);
%>
本文介绍了一种在JSP页面正确输出中文字符的方法。通过设置页面的Content-Type为text/html;charset=utf-8,并对字符串进行编码转换,实现了中文的正常显示。
1001

被折叠的 条评论
为什么被折叠?



