• Post Reply Bookmark Topic Watch Topic
  • New Topic

Class cannot be resolved  RSS feed

 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I have application in JBoss test.war. In test.war I call a class from test.war/WEB-INF/classes:


But I get error:

An error occurred at line: 7 in the jsp file: /test.jsp
Generated servlet error:
DBDriver cannot be resolved


Any ideas?

thanks,
Alex
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66260
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to import DBDriver.
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Really? I thought that all classes directly under WEB-INF/classes I visible to everybody in current application.
So how do I import it: <%@page import="java.sql.*, java.util.*, javax.naming.*,javax.sql.*,DBDriver"%> ?

[ June 08, 2005: Message edited by: Alex Kravets ]
[ June 08, 2005: Message edited by: Alex Kravets ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66260
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Really? I thought that all classes directly under WEB-INF/classes I visible to everybody in current application.


The packages and classes in WEB-INF/classes are placed in the classpath. But just like classes in java.util and other packages, you need to import the packages and classes that you will use.

So how do I import it


Just like any other classes.

One caveat: classes imported into JSPs must be in a package other than the default. Otherwise, the container will be unable to find it.
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ahh...got it. thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!