• Post Reply Bookmark Topic Watch Topic
  • New Topic

regarding accessing java class thru javabean in jsp

 
Brij Garg
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pardon me if this is not the right place to post this issue.

Structure for my web application is given below

webapps/forum --> home for my application

forum/WEB-INF/com/mypackage
forum/WEB-INF/lib
forum/META-INF
forum/jsp
forum/work


Now jsp folder has one jsp authontication.jsp.

Some part of code in authontication.jsp is given below




dbConnection1.class file is in mypackage folder.

But when I execute authentication.jsp

Error I get is �java.lang.NoClassDefFoundError: org/apache/jsp/dbConnection1


I like to know what is incorrect here. Do we need to mention classpath somewhere so that containers look for dbConnection1.class in WEB-INF/classes/com/mypackage directory ? If yes please help me with this.
Thanks
 
Vijitha Kumara
Bartender
Posts: 3952
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Container won't automatically import the class files for you. It will find the class files in the classpath (WEB-INF/classes/... in this case). You should have classes folder inside WEB-INF and within that you can have your package structure. Also you should import the class (like you have imported other java packages) you are using in <jsp:useBean .. > tag.

 
Brij Garg
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even after importing com.mypackage, still same error is coming.
 
Brij Garg
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot. It is done now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!