Sathesh
Sathesh

Reputation: 378

Unable to compile class for JSP?

I am having html file which is in var/www/file.html Here i am having link to .jsp file which is in var/lib/tomcat6/webapps. when i click the jsp file link the browser throws HTTP Status 500 - Unable to compile class for JSP; error while adding the

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

namespace to that .jsp file, i am not using any IDE. I have added the mysql_connector.jar file to the bashrc and environment file. Finally, i am using ubuntu 13.1 operating system.

var/www/index.html

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

var/lib/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>

Upvotes: 3

Views: 194

Answers (1)

Naren
Naren

Reputation: 1477

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 under Test folder that means webapps/Test/index.html)

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

first.jsp (it should be under 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>

Upvotes: 2

Related Questions