jsp中include html出现 乱码,球大神指点

hanyao1847 2015-05-14 09:05:00
jsp中include html文件时引入的内容变成乱码了,jsp中的中文可以正常显示,在web.xml中添加一下内容后还是乱码
<jsp-config>
<jsp-property-group>
<description>
Special property group for JSP Configuration JSP
example.
</description>
<display-name>JSPConfiguration</display-name>
<url-pattern>*.jsp</url-pattern>
<el-ignored>true</el-ignored>
<page-encoding>UTF-8</page-encoding>
<scripting-invalid>false</scripting-invalid>
<include-prelude></include-prelude>
<include-coda></include-coda>

<description>
Special property group for JSP Configuration JSP
example.
</description>
<display-name>JSPConfiguration</display-name>
<url-pattern>*.html</url-pattern>
<el-ignored>true</el-ignored>
<page-encoding>UTF-8</page-encoding>
<scripting-invalid>false</scripting-invalid>
<include-prelude></include-prelude>
<include-coda></include-coda>
</jsp-property-group>
</jsp-config>

jsp文件内容
<%@ page language="java" import="java.util.*" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>首页</title>
<meta name="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="lib/bootstrap/bootstrap.css" rel="stylesheet">
<script src="lib/jquery.min.js"></script>
<script src="lib/bootstrap/bootstrap.min.js"></script>
<script src="lib/icheck.js"></script>
<link href="css/main.css" rel="stylesheet">
<link href="css/blue.css" rel="stylesheet">
<link href="css/navigation.css" rel="stylesheet">
<link href="css/list.css" rel="stylesheet">
<link href="css/buttons.css" rel="stylesheet">
</head>

<body>
<jsp:include page="html/header.html"></jsp:include>
</body>
</html>
...全文
100 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
peng-peng- 2018-08-15
  • 打赏
  • 举报
回复
楼主能不能分享一份前几天下载的,《深入理解Java虚拟机:JVM高级特性与最佳实践》高清完整PDF版资源,原来的资源下载不了了,谢谢
hanyao1847 2015-05-15
  • 打赏
  • 举报
回复
解决方案:把html文件后缀改为jsp,然后在文件开头添加<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
bdbody 2015-05-14
  • 打赏
  • 举报
回复
是不是编码的问题啊?也有可能是环境的问题

81,122

社区成员

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

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