I have a dynamic web project in Eclipse which I run on Glassfish4. In the project, there is an index.jsp file given below. When I run this jsp on the server, I get the error:
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)
This is an internal server error with the description - The server encountered an internal error that prevented it from fulfilling this request.
<%@ 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>
I looked in google and other sites, but found no working solution. The server log stack trace also did not help. Please help me.
The issue is that you have "Content-Type" declared twice (as "text/html"). This against specifications and is causing your website to throw an error.
You just can't use both tags simultaneously. The HTTP protocol also provides the Content-Type encoding. So unless you know how your website is serving those pages, don't mess with Content-Type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With