jam*_*mes 7 java jsp java-ee glassfish-4
我在Eclipse中有一个动态Web项目,我在Glassfish4上运行.在项目中,有一个index.jsp文件,如下所示.当我在服务器上运行此jsp时,我收到错误:
org.apache.jasper.JasperException: /index.jsp(1,1) PWC5988: Page directive: illegal to have multiple occurrences of 'contentType' with different values (old: text/html, new: text/html; charset=ISO-8859-1)
这是带有描述的内部服务器错误 - 服务器遇到内部错误,导致无法完成此请求.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="css/designs.css">
</head>
<body>
Content
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我查看了谷歌和其他网站,但没有找到可行的解决方案.服务器日志堆栈跟踪也没有帮助.请帮我.
Sky*_*ion 11
问题是你有两次声明"Content-Type"(如"text/html").这违反了规范,导致您的网站出错.
你不能同时使用这两个标签.HTTP协议还提供Content-Type编码.因此,除非您知道您的网站如何为这些页面提供服务,否则请不要使用Content-Type.