早教吧 育儿知识 作业答案 考试题库 百科 知识分享

HTTPStatus500错误HTTPStatus500---------------------------------------------------------------------------------typeExceptionreportmessagedescriptionTheserverencounteredaninternalerror()thatpreventeditfromfulfillingthisreques

题目详情
HTTP Status 500 错误
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:18 in the jsp file:/test_jsp.jsp
Cannot invoke write(String) on the primitive type void
15:}
16:Date now1=new Date();
17:out.println("执行后时间:"+DateFormat.getTimeInstance().format(now1)+"
");
18:out.println("程序总共循环了:"+count+"次
");
19:%>
20:
21:
An error occurred at line:18 in the jsp file:/test_jsp.jsp
Syntax error on tokens,delete these tokens
15:}
16:Date now1=new Date();
17:out.println("执行后时间:"+DateFormat.getTimeInstance().format(now1)+"
");
18:out.println("程序总共循环了:"+count+"次
");
19:%>
20:
21:
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:317)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.18
以下是源代码;
测试JSP运行时间
▼优质解答
答案和解析
你太不小心了, 有两个错误:
1.你没有设置编码,你的页面里有中文,而默认的ISO-8859-1并不符合.所以你应该在第一行加入一句

2.你的程序:out.println("程序总共循环了:"+count+"次
");
最后一个分号看见了吗?你改成英文符号的";",而不能用中文的";".