Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class Not Found using JSWDK

 
Hermione Krum
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there, I am trying to import a bean class "FileListFilter", and I have put the FileListFilter.class in the WEB-INF/servlets and I am trying to import the bean using
<%@ page import="FileListFilter"%> however, the compiler keeps complaining:
com.sun.jsp.JspException: Compilation failed:work\%3A8080%2Fproject\index_jsp_1.java:17: Class FileListFilter not found in import.
import FileListFilter;
^
1 error
Please help and Thanks so much!!!

 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try making your class a member of a package, and then import the entire package.

Bosun
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18276
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not WEB-INF/servlets - you should be placing the file in WEB-INF/classes! With subdirectories matching the components of the package name if you defined the class as a member of a packed.
 
Hermione Krum
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I try to make the class a member of a package, and then import the entire package, actually I've put the class("FileListFilter") inside an existing example package("num"), it works fine when I import the package using <%@ page import="num.*"%>, however it fails when I try to call FileListFilter within the jsp!!
And for placing the file in WEB-INF/classes, there's no directory as "classes" in JSWDK, does it mean that I have to add it by myself?? And in fact I try to add the directory "classes" under WEB-INF, and put my classes inside it.. but it still fails when I import the package by using <%@ page import="FileListFilter"%>.
Thanks so much for your help!!!
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well if FileListFilter is inside the num package, you need to import it like that.
<%@ page import="num.FilListFilter" %>

Also, unless there is a business directive not to, you should really not be using the JSWDK. Tomcat is the RI, Sun even says so.
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
Mike Curwen said:
Also, unless there is a business directive not to, you should really not be using the JSWDK. Tomcat is the RI, Sun even says
so.

I'm using the JSWDK-1.0 at home for testing and learning purposes. It's the only thing I found for JSP on W98. Does your reccomendation apply to learners or just commercial application deployment?

Terry
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It applies to you as well.

Tomcat works fine on win98. There are a few tweaks that you may need to do regarding memory. But they've been asked and answered several times here at the ranch, so as soon as you get a certain error, just use Javaranch's search function and you'll find lots of help.

Not only is it the better product, the JSWDK hasn't been updated in a quite some time, so you are using an older version of both the servlet and JSP spec. Better to upgrade.
[This message has been edited by Mike Curwen (edited September 18, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic