我想是这样的?!
程序的主要是这样的,大家在我建立的留言薄上留言,然后我将留言放在一个gbook.txt文件中
然后我用一个JSP文件导出这个gbook.txt文件看看,
结果出现以下错误提示:org.apache.jasper.JasperException: /gbook.jsp(14,2) Invalid byte 2 of 2-byte UTF-8 sequence.
我想可能是gbook.txt文件的保存类型的问题,然后我就把gbook.txt改成unicode类型,结果出现乱码。
大家帮忙看看是什么问题?谢谢大家了。
在gbook.txt未转换类型前,它的文件里的字符一切正常,证明我写入文件是正确的。
到处文件的gbook.jsp内容如下:
response.setHeader("Cache-Control","no-store");
response.setHeader("Pragma","no-cache");
response.setDateHeader("Expires",0);
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<title>Star的访问者留言薄</title>
</head>
<body text="#000000" BGCOLOR="#FFFFFF" Background="b01.jpg">
<h2 align="center">Star的访问者留言薄</h2>
<hr width="100%">
<%@ include file="gbook.txt" %>
<a href="gform.html">
<p align="center">返回留言表单</a></p>
</body>
</html>
是不是 <%@ include file="gbook.txt" %>这个地方有点问题啊。