我在做一个简单的jsp页面,主要是:在包chapter35中创建一个新的类ComputeTax.java,然后在jsp中导入这个类。。。最后运行时出现了500的错误。。。求助各位大侠前辈啊
jsp的代码如下:
<%@ page import="ComputeTax"%>
<html>
<head>
<title>ComputeTax</title>
</head>
<body>
<%
String status=request.getParameter("status");
double income=Double.parseDouble(request.getParameter("income"));
double tax=computeTax(income);
out.println("Taxable Income: <b>"+income+"</b><br>");
out.println("Filing Status: <b>"+status+"</b><br>");
out.println("Tax: <b>"+tax+"</b><br>");
%>
</body>
</html>
我的java源代码的主要代码如下:
public class ComputeTax {
double computeTax(double income){
税的计算方法。。。
}
}找不到这个页面,你把你的那个类放在一个包里面再试试呢?
这个没有用啊。。。依旧显示的是:
HTTP Status 500 -
--------------------------------------------------------------------------------
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: 6 in the generated java file
Only a type can be imported. chapter35.Loan resolves to a package
An error occurred at line: 14 in the jsp file: /chapter35/ComputeLoan.jsp
Loan cannot be resolved to a type
11: request.getParameter("annualInterestRate"));
12: int numberOfYears = Integer.parseInt(
13: request.getParameter("numberOfYears"));
14: Loan loan =
15: new Loan(annualInterestRate, numberOfYears, loanAmount);
16: %>
17: Loan Amount: <%= loanAmount %><br />
An error occurred at line: 15 in the jsp file: /chapter35/ComputeLoan.jsp
Loan cannot be resolved to a type
12: int numberOfYears = Integer.parseInt(
13: request.getParameter("numberOfYears"));
14: Loan loan =
15: new Loan(annualInterestRate, numberOfYears, loanAmount);
16: %>
17: Loan Amount: <%= loanAmount %><br />
18: Annual Interest Rate: <%= annualInterestRate %><br />