Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JessJenn

Status
Not open for further replies.

BlueBeep

Programmer
Aug 13, 2002
23
US
Hey guys. This is my first time with JSP, and I'm trying to create a JavaBean. I seem to be getting an error when I try to set up the following:

I have a folder called "test" which is the root of my app. Under this directory, I have a folder called "WEB-INF", then a folder called "classes" then the folder called "mathy". Under "mathy" I have a the java file called average.java along with the compiled class file.

The code for average.java is as follows:

package mathy;
import java.io.Serializable;

public class average implements Serializable {

private double total = 0;
public average(double n1, double n2, double n3) {
total = n1 + n2 + n3;
total = total / 3;
}
public double getAverage() {
return total;
}
}

then under the original "test" folder, I have a jsp page called "exp-1.jsp" with the following code:

<% mathy.average av1 = new mathy.average(34.4, 56.1, 694.3); %>

Now, I'm not trying to execute any methods, just trying to see if a bean can be made. But now luck. Can anyone help? Thanks, I really appreciate it.


I get the following error by the way with Tomcat Version 4.0-b5:


A Servlet Exception Has Occurred
org.apache.jasper.JasperException: Unable to compile class for JSPC:\jakarta-tomcat-4.0-b5\work\localhost\test\exp_0002d4_jsp.java:55: Class mathy.average not found.
mathy.average av1 = new mathy.average(34.4, 56.1, 694.3);
^
C:\jakarta-tomcat-4.0-b5\work\localhost\test\exp_0002d4_jsp.java:55: Class mathy.average not found.
mathy.average av1 = new mathy.average(34.4, 56.1, 694.3);
^
2 errors
 
Sorry guys, I made a mistake on the topic field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top