• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Class cannot be resolved

 
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to import DBDriver.
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ahh...got it. thanks!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic