Failed to compile class for JSP?

I have an html file which is located in the var / www / file.html file. Here I have a link to a .jsp file which is located in var / lib / tomcat6 / webapps. when I click on the link to the jsp file, the browser issues an HTTP Status 500 - Unable to compile class for JSP; when adding

<%@page import="java.sql.*"%>

into this .jsp file, I am not using an IDE. I added the mysql_connector.jar file to the bashrc and environment file. Finally, I am using the ubuntu 13.1 operating system.

var / www / index.html

<html>
<head>
<body>
  <a href="demo/create.jsp">Create your iDesk</a>
</body>
</html>

var / Library / tomcat6 / WebApps / demo / First.jsp

<%@ page language="java" contentType="text/html;%>
<%@ page language="java" import="java.sql.*"%>
<html>
<head>
<title>Create Your Own Meeting</title>
</head>
<body>
<%
if (request.getParameterMap().isEmpty()) {
    //
    // getting parameters here
    //
 %>
 </body>
 </html>
+3
source share
1 answer

it should be in this format

    <%@page import="packageName.*" %>

Example:

<%@page import="java.sql.*" %>

I assumed ur project name as "Test"

your index.html (it should be in the Test folder, which means webapps / Test / index.html)

<html>
<head>
<body>
  <a href="demo/first.jsp">Create your iDesk</a>
</body>
</html>

first.jsp( webapps/Test/demo/first.jsp)

<%@ page language="java" import="java.sql.*"%>
<html>
<head>
<title>Create Your Own Meeting</title>
</head>
<body>

<%
out.println("Tester");
if (request.getParameterMap().isEmpty()) {
    //
    // getting parameters here
    //
}
 %>
 </body>
 </html>
</html>
+2

All Articles