!!header.jsp:!!!
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>JOB!</title>
</head><body>
<table width="750" border="0" align="center">
----这里面有中文内容
</table>
!!index.jsp:!!
<%@ include file="header.jsp"%><table width="750" border="0" align="center">
----这里面也有中文内容
</table><%@ include file="footer.jsp"%>
然后发现,header里的中文正确显示,而index.jsp中却乱码,怎么解决?
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>JOB!</title>
</head><body>
<table width="750" border="0" align="center">
----这里面有中文内容
</table>
!!index.jsp:!!
<%@ include file="header.jsp"%><table width="750" border="0" align="center">
----这里面也有中文内容
</table><%@ include file="footer.jsp"%>
然后发现,header里的中文正确显示,而index.jsp中却乱码,怎么解决?
<jsp:include page="header.jsp"/>之后,连header.jsp里面都成了乱码了...
这句加在index.jsp
<jsp:include page="header.jsp" flush="true"/>
这种形式,那么
<%@ include file="header.jsp"%>
的会报错说不能重复声明contentType,该怎么解决呢?
后面不能跟代码, 只能这样
<%@ include file="aa.jsp">
<%@ include file="bb.jsp">
.
.
.
<%@ include file="cc.jsp">
<jsp:include page="">是动态引用 ,就像是使用函数两种办法在引用JSP文件时,都要执行的。