Reputation: 1218
I'm trying to use a class I defined in a package in my Java Web Project, however I keep getting errors when I use the class I defined in the package. The error is saying that the class cannot be resolved to a type. I am importing the package that I made that contains the class that I want to use.
Upvotes: 0
Views: 125
Reputation: 1109695
The class needs to be located in webapp's /WEB-INF/classes
in a folder structure which represents the declared package
. So if you have for example
package com.example;
public class Foo {
// ...
}
then you should have a /WEB-INF/classes/com/example/Foo.class
file. Please keep in mind that this is case sensitive as everything else in Java.
Another possible cause is when you're trying to use it in a <jsp:useBean>
tag, that it should have a (implicit) default constructor which doesn't throw an exception upon construction.
Upvotes: 2