Working on a web application and implementing a class called Calculator that calculates certain things about your body to determine how to focus your diet.
I am implementing this caluclator but I am getting an error. Here is the error; and following it below is an example of the source code. If you could tell me where my problem is that would be incredibly appreciated.
The Error:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 83 in the jsp file: /updateProfile.jsp
Calculator cannot be resolved
80: a6 = "checked";
81: }
82:
83: out.println(Calculator.percentBodyFat("f","145","38","38","38","27","27","27",67.0,"6.5"));
84:
85: String theName = request.getParameter("name");
86: if(theName != null)
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
The Source code:
import java.io.BufferedReader;
package hygeia;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;
public class Calculator {
public static double percentBodyFat(String sex, String w, String h1,
String h2, String h3, String a1, String a2, String a3, double height, String wr)
{
//statements
}
public static double leanBodyMass(double weight, double percentBodyFat)
{
//statements
}
public static double protein(double leanBodyMass, int activLevel)
{
//statements
}
}
It is able to compile but I cannot get it to work with the jsp.
It seems like it should be very simple.
You have to include the
Calculatorclass in your JSP page