求助一个Jsp问题
源文件是:
gaods1.jsp
<%@ page contentType="text/html;Charset=GB2312"
%>
<html><body bgcolor=yellow>
<p> 加载一个jsp文件,该文件负责计算连续整数之和:
<jsp:include page="computer.jsp">
<jsp:param name="item" value="100" />
</jsp:include>
</body></html>
computer.jsp
<%@ page contentType="text/html;Charset=GB2312"
language="java" import="java.sql.*"
errorPage=""
%>
<html><body>
<% String str=request.getParameter("item");
if( str==null)
str=" ";
int n=Interger.parseInt(str);
int sum=0;
for(int i=1;i<=n;i++)
sum=sum+i;
}
out.println("<br> 从1~"+n+"的连续和是:</br>"+sum);
%>
</body></html>
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 JSPAn error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\ch01\computer_jsp.java:30: 'try' without 'catch' or 'finally'
try {
^
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\ch01\computer_jsp.java:53: illegal start of type
} catch (Throwable t) {
^
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\ch01\computer_jsp.java:63: expected
}
^
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\ch01\computer_jsp.java:64: 'class' or 'interface' expected
}
^
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\ch01\computer_jsp.java:65: 'class' or 'interface' expected
^
5 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:1002)
org.apache.jsp.ch01.gaods1_jsp._jspService(gaods1_jsp.java:42)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspSer