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

can not load beanclass  RSS feed

 
jawwad ahmed
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well i have putted bean class in the web-inf\classes folder
and page.jsp in c:\tomcat\webapps\examples
but still it is giving error.Please tell i have spend a lot of time but i can't get.
Page.jsp:
<html>
<head><title>Page Directive</title></head>
<body>
<%@page language="java"%>
<jsp:useBean id="name" scope="page" class="TestBean"/>
</body>
</html>

import java.beans.*;
public class TestBean
{
private int val;
public void set(int i){
this.val=i;
}
public int get(){
return val;
}
}
Giving following error..
:\tomcat4\work\localhost\examples\Page$jsp.java:64: Class org.apache.jsp.TestBean not found.
TestBean name = null;
^
An error occurred at line: 6 in the jsp file: /Page.jsp
Generated servlet error:
C:\tomcat4\work\localhost\examples\Page$jsp.java:67: Class org.apache.jsp.TestBean not found.
name= (TestBean)
^
An error occurred at line: 6 in the jsp file: /Page.jsp
Generated servlet error:
C:\tomcat4\work\localhost\examples\Page$jsp.java:72: Class org.apache.jsp.TestBean not found.
name = (TestBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "TestBean");
^
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
try to add a package declaration to your class, I�ve seen bugs in some versions of Tomcat and this was one of them(couldn�t find classes without package declaration).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!