火狐浏览器错误提示:纯文本文件的字符编码未声明。

火狐浏览器错误提示:纯文本文件的字符编码未声明。如果该文件包含 US-ASCII 范围之外的字符,该文件将在某些浏览器配置中呈现为乱码。该文件的字符编码需要在传输协议层声明,或者在文件中加入一个 BOM(字节顺序标记)

这是代码页

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


Insert title here

查询所有添加客户
编号名字来源产业级别固定电话移动电话
${c.cust_id}${c.cust_name}${c.cust_source}${c.cust_industry}${c.cust_level}${c.cust_phone}${c.cust_mobile}

function search(){ var id = $("#searchId").val(); //var id=document.getElementById('searchId').value; //console.log(id); alert(id); window.location.href="/hibernate02/SearchServlet?method=searchById&cust_id="+id; }

把你的页面用记事本打开,另存为utf格式。保存。

 <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html >
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<title>Insert title here</title>
</head>
<body>
<table border="1"  align="center">
        <tr align="center">
            <td colspan="2">
            <input type="text" name="id" id="searchId"/>
            </td>
            <td>
            <input type="button" name="button1" value="查询" onclick="search()" >
            </td>
            <td colspan="2">
            <a href="${pageContext.request.contextPath}/SearchServlet?method=findAll"> 查询所有</a>
            </td>
            <td colspan="2">
            <a href="${pageContext.request.contextPath}/add.jsp">添加客户</a>
            </td>   
        </tr>
        <tr>
            <td>编号</td>     
            <td>名字</td>     
            <td>来源</td>     
            <td>产业</td>     
            <td>级别</td>     
            <td>固定电话</td>       
            <td>移动电话</td>       
        </tr>
        <c:forEach items="${customers}" var="c">
        <tr align="center">
            <td>${c.cust_id}</td>
            <td>${c.cust_name}</td>
            <td>${c.cust_source}</td>
            <td>${c.cust_industry}</td>
            <td>${c.cust_level}</td>
            <td>${c.cust_phone}</td>
            <td>${c.cust_mobile}</td>
        </tr>
        </c:forEach>
    </table>
</body>
<script type="text/javascript" src="/hibernate02/js/jquery-1.11.3.min.js"></script>
<script charset="UTF-8">
function search(){

    var id = $("#searchId").val();
    //var id=document.getElementById('searchId').value;
    //console.log(id);
    alert(id);
    window.location.href="/hibernate02/SearchServlet?method=searchById&cust_id="+id;

}

</script>
</html>