Reputation: 187
I'm using Eclipse Kepler. I keep getting an error message with this code in a .jsp:
HTTP Status 500 - Unable to compile class for JSP:
type Exception report
message Unable to compile class for JSP:
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 13 in the jsp file: /index.jsp Syntax error on token "import", delete this token 10: 11: 12: 13: <% page import ="java.util.Date" %> 14: 15: <%= new Date () %> 16:
An error occurred at line: 13 in the jsp file: /index.jsp Syntax error, insert ";" to complete Statement 10: 11: 12: 13: <% page import ="java.util.Date" %> 14: 15: <%= new Date () %> 16:
An error occurred at line: 15 in the jsp file: /index.jsp Date cannot be resolved to a type 12: 13: <% page import ="java.util.Date" %> 14: 15: <%= new Date () %> 16: 17: 18:
Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468) org.apache.jasper.compiler.Compiler.compile(Compiler.java:378) org.apache.jasper.compiler.Compiler.compile(Compiler.java:353) org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.42 logs.
There is the code:
<%@ 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">
<title>Insert title here</title>
</head>
<body>
<% page import ="java.util.Date" %>
<%= new Date () %>
</body>
</html>
Thank you
Upvotes: 0
Views: 15216