帮我看看这个JSP中乱码怎么解决?

chaihl 2007-09-18 10:28:08
loc.jsp
<%@page contentType="text/html;charset=gb2312"%>
<%@include file="top.txt"%>
<p align="center">
<%out.println("此书出版了,快来看看吧!还有更多的好书等着您呢!");%>
</p>
<%@include file="bottom.txt"%>

top.txt

<html>
<head>
<title>《JSP从入门到实战》网站</title>
</head>
<body>
<p align="center"><b><font size="5">《JSP从入门到实战》网站</font></b></p>

bottom.txt

<hr>
<p align="center">
<font size="3">@电子工业出版社版权所有 2004-2008</font><br>
<font size="3">制作人:邓子云</font><br>
<font size="3">联系方式:dengziyun@126.com</font><br>
</body>
</html>

文件中bottom.txt和top.txt的内容在JSP中乱码,为什么?怎么解决?
...全文
168 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
guorujian 2007-09-19
  • 打赏
  • 举报
回复
如果你用的是Eclipse建议你更改一下文本文件的属性,选择“其他”——gbk
然后重新启动web服务器再试试!
wikiyellow 2007-09-19
  • 打赏
  • 举报
回复
加<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
chaihl 2007-09-19
  • 打赏
  • 举报
回复
在两个TXT文件头部加入<%@ page contentType="text/html; charset=GB2312" %>是正确的。谢谢各位了!
Moon0Light 2007-09-18
  • 打赏
  • 举报
回复
在前面加入<%request.setCharacterEncoding("GB2312") ;%>试试,建议把txt写成jsp的吧,在页面里也加上<%@ page contentType="text/html; charset=GB2312" %>。JSP很久不用了,不知道能不能解决~表见怪……

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧