|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
I'm new and trying to follow an example from a wrox book on how to set up a jsp with a bean. I'm doing something wrong but I can't figure out what my problem is....
Here's the story... I compile my .java file from the following directory D:\Tomcat 4.1\webapps\begjsp-ch04\web-inf\classes as follows javac com\wrox\cars\CarBean.java I point my browser to http://dsti-128:8080/begjsp-ch04/carPage.jsp and I get this error: type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 14 in the jsp file: /begjsp-ch04/carPage.jsp Generated servlet error: [javac] Compiling 1 source file D:\Tomcat 4.1\work\Standalone\localhost\_\begjsp-ch04\carPage_jsp.java:49: package com.wrox.cars does not exist com.wrox.cars.CarBean myCar = new com.wrox.cars.CarBean(); out.write("\r\n\t\r\n\tI own a "); ^ here's the contents of carPage.jsp <html> <head> <title>Using a JavaBean</title> </head> <body> <h2> Using a JavaBean</h2> <% com.wrox.cars.CarBean myCar = new com.wrox.cars.CarBean(); %> I own a <%= myCar.getMake() %> <br /> <% myCar.setMake("Ferrari"); %> Now I own a <%= myCar.getMake() %> </body> </html> here's the contents of CarBean.class package com.wrox.cars; import java.io.Serializable; public class CarBean implements Serializable { public CarBean(){ } private String make = "Ford"; public String getMake() { return make; } public void setMake(String make) { this.make = make; } } <***Location of my class CALLED CarBean.class********> 10/07/2002 03:03 PM 458 CarBean.class 10/03/2002 01:53 PM 279 CarBean.java D:\Tomcat 4.1\webapps\begjsp-ch04\web-inf\classes\com\wrox\cars> <***Location of my JSP CALLED carPage.jsp ********> 10/07/2002 03:25 PM 319 carPage.jsp D:\Tomcat 4.1\webapps\ROOT\begjsp-ch04> <***environmental variables**********> CATALINA_HOME = D:\Tomcat 4.1 CLASSPATH = D:\Tomcat 4.1\common\lib\servlet.jar;.; ... D:\Tomcat 4.1\webapps\begjsp-ch04\web-inf\classes; JAVA_HOME = D:\j2sdk1.4.0_01 PATH = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem; ... C:\Program Files\Common Files\Adaptec Shared\System;D:\j2sdk1.4.0_01\bin |
|
#2
|
|||
|
|||
|
You say your jsp is in "D:\Tomcat 4.1\webapps\ROOT\begjsp-ch04" and your bean is in "D:\Tomcat 4.1\webapps\begjsp-ch04"?
Those need to be the same. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > jsp package directory structure problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|