• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can't use Bean

 
Ego Tang
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
When I run jsp on tomcat I get error 500 stating
"org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
An error occurred between lines: 3 and 5 in the jsp file: /CounterBean.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\localhost\howjsp\CounterBean$jsp.java:60: Class org.apache.jsp.CounterBean not found.
CounterBean counterBean = null;"
The CounterBean.jsp is placed in the Context directory(\howjsp) which is configured correctly in server.xml. The content is:
<HTML>
<BODY>
<jsp:useBean id="counterBean"
scope="session"
class="CounterBean"/>
....
</HTML>
And the CounterBean.java file has been compiled and placed in \howjsp\WEB-INF\classes.
Thanks a lot.
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like your saying that you ahve a JSP page named CounterBean and also bean named CounterBean? And you use the bean in the JSP of the same name? Sure this'll work but it can get very confusing and is probably not the best design.
I know that there are issuse with the useBean expecting a fully qualified class name in the useBean, using beans that are not actually part of a package other than the default means you dont use a package name in the classname attribute. Try putting your bean into a package and using the fully qualified class name in the useBean tag.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!