0

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.

1
  • 1
    For future questions, an exact copypaste of the error/exception message and stacktrace would be more then helpful. Also a snippet of how you're importing and using it would be helpful. Otherwise it's a bit of guessing to the real cause. Commented Sep 28, 2011 at 18:58

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.