Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Tomcat doesn't know my bean  RSS feed

 
guenter krannich
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm just starting to learn JSP and java beans, so this probably is a common silly mistake:
I created a jsp, where I want to use "ProbeBean"; "ProbeBean.class" and a "manifest.mf" (containing " Name: ProbeBean.class Java-Bean: true") are in a jar file, which together with the jsp is in the war file that I deploy into Tomcat 5.0.
After starting the jsp, Tomcat tells me "cannot resolve symbol symbol : class ProbeBean ".
I'd appreciate if somone could be patient enough to help on my way!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66187
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your bean should be in a package other than the default. Be sure to place the jar file in WEB-INF/lib.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I suspect might be missing is the following statement near the beginning of the jsp:

<%@ page import="mypackage.ProbeBean" %>

Just like regular java classes, JSPs require an import if you use classes from another package. The above code assumes that your class is in a package called mypackage. If you didn't put your bean in a package, I suggest you do so, as this is the way it's done in the real world, and it helps keep things organized.
 
guenter krannich
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks!
just putting the bean in a package did the job!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!