!!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中却乱码,怎么解决?

解决方案 »

  1.   

    两行include改成类似:
    <jsp:include page="header.jsp"/>之后,连header.jsp里面都成了乱码了...
      

  2.   

    <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
    这句加在index.jsp
      

  3.   

    谢谢ls!但是还有个问题,这个解决只能用于
    <jsp:include page="header.jsp" flush="true"/>
    这种形式,那么
    <%@ include file="header.jsp"%>
    的会报错说不能重复声明contentType,该怎么解决呢?
      

  4.   

    <%@ include file="header.jsp">
    后面不能跟代码, 只能这样
    <%@ include file="aa.jsp">
    <%@ include file="bb.jsp">
    .
    .
    .
    <%@ include file="cc.jsp">
      

  5.   

    sorry,说错了,不是不能,<%@ include file="header.jsp">本身是对另一个jsp的引用,它的前面也加<@page .....>的话就是重复申明
      

  6.   

    <%@ include%>是静态引用 
    <jsp:include page="">是动态引用 ,就像是使用函数两种办法在引用JSP文件时,都要执行的。