The only
java beans I can get to work are the ones that come in the example directory.
I made a simple
jsp and put it in the 'cal' package under the examples directory. It works fine if use the TableBean that comes with
tomcat as follows:
<jsp:useBean id="table" scope="session" class="cal.TableBean" />
If I save TableBean as TableBean2.java and I only change the class name and the constructor to TableBean2 and recompile, I then use the following to call it in my jsp
<jsp:useBean id="table" scope="session" class="cal.TableBean2" />
I get the following set of errors: I get these errors everywhere I use a bean I create. I do not get errors when I use the default beans. Is there a configuration parameter i need to set? I don't see it in any books.
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 13 in the jsp file: /jsp/cal/hw6.jsp
Generated
servlet error:
[javac] Compiling 1 source file
C:\Tomcat_new\work\Standalone\localhost\examples\jsp\cal\hw6_jsp.java:63: cannot resolve symbol
symbol : class TableBean2
location: package cal
cal.TableBean2 table = null;
^
An error occurred at line: 13 in the jsp file: /jsp/cal/hw6.jsp
Generated servlet error:
C:\Tomcat_new\work\Standalone\localhost\examples\jsp\cal\hw6_jsp.java:65: cannot resolve symbol
symbol : class TableBean2
location: package cal
table = (cal.TableBean2) pageContext.getAttribute("table", PageContext.SESSION_SCOPE);
^
An error occurred at line: 13 in the jsp file: /jsp/cal/hw6.jsp
Generated servlet error:
C:\Tomcat_new\work\Standalone\localhost\examples\jsp\cal\hw6_jsp.java:68: cannot resolve symbol
symbol : class TableBean2
location: package cal
table = (cal.TableBean2) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "cal.TableBean2");
^
3 errors