Am trying to get a JSP example from the book "Inside Servlets, 2nd Edition" to work. It uses a Java bean class (EmployeeBean.class) and no matter what I do so far I can't seem to get it to find the EmployeeBean.class. Always get an error like this when try to access the JSP that uses the bean:
/home/lkennon/servletexec/ServletExecAS/se-red1/ServletExecData/default/is/pagecompile/_ch18/_param_xjsp.java:26: Class pagecompile._ch18.EmployeeBean not found.
EmployeeBean employee = (EmployeeBean)pageContext.getAttribute( "employee" );
I have tried the following:
1. Placing the EmployeeBean.class directly in ServletExec's classpath in the StartServletExec script (this is on Linux).
2. Creating a EmployeeBean.jar file with the EmployeeBean.class in it and putting that in the WEB-INF/lib subdirectory for this web app.
3. Placing the EmployeeBean.class file in the Servlets subdirectory.
Any ideas, suggestions?
and voila! it worked (once I specified the full class name with package in the JSP.
Not sure why that would work and without a package does not, but hey, I am happy, it works and I can continue to play with this.
Originally posted by Lawrence Kennon:
Thanks! I see it in the FAQ now. I swear I did look at the FAQ first, but was probably in too big a hurry to see what was right there. Also I was working from examples in a book and wrongly assumed therefore they should work if I just got things configured right. In any case the exercise was useful for me and hopefully guarantees the lesson will stay in my memory for a while.
If it was an older book, they might have worked when it was written.
The JVM was tightened up in 1.4.1 to bring it closer to the original spec.