"Import cannot be resolved" with JSP

user1884132 picture user1884132 · Dec 7, 2012 · Viewed 21.8k times · Source

I am trying to call a Java class from a JSP page. I have created the project using JDeveloper.

I am getting an error that says "The import cannot be resolved". I have added the Class file in WEB-INF, root folder, and tried compiling, but it still shows the same error.

Below is the code:

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
    </head>
    <body>
        <p>  
            <%@ page import="java.util.*"%>
            <%@ page import="Class1"%>
            <% 
                Class1 tc=new Class1("test");
                out.print(tc.str);
            %>
        </p>
    </body>
</html>

Answer

PermGenError picture PermGenError · Dec 7, 2012

you should give fully qualified name for your class. (packagename.classname) like:

    <%@ page import="pkgname.Class1"%>