刚上手Jsp 现已装完jdk1.6和tomcat 并能成功打开tomcat测试网页
现在ROOT下加了一个JSP网页 内容如下:
<% @ page contentType="text/html;charset=GB2312" %>
<HTML>
<BODY BGCOLOR=cyan><font size="4">
<%!
int i=0;
%>
<%
i++;
%>
<p>你是第<% =i %>
个访问本站的客户。
</p>
</font>
</BODY>
</HTML>
但无法正确打开 网页显示如下:
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: 1 in the jsp file: /example_2.jsp
Syntax error on token "contentType", VariableDeclaratorId expected after this token
1: <% @ page contentType="text/html;charset=utf-8" %>
2: <HTML>
3: <BODY BGCOLOR=cyan><font size="4">
4: <%!
An error occurred at line: 1 in the jsp file: /example_2.jsp
contentType cannot be resolved to a type
1: <% @ page contentType="text/html;charset=utf-8" %>
2: <HTML>
3: <BODY BGCOLOR=cyan><font size="4">
4: <%!
An error occurred at line: 1 in the jsp file: /example_2.jsp
Syntax error, insert ";" to complete LocalVariableDeclarationStatement
1: <% @ page contentType="text/html;charset=utf-8" %>
2: <HTML>
3: <BODY BGCOLOR=cyan><font size="4">
4: <%!
An error occurred at line: 10 in the jsp file: /example_2.jsp
Syntax error on token "=", @ expected
7: <%
8: i++;
9: %>
10: <p>你是第<% =i %>
11: 个访问本站的客户。
12: </p>
13: </font>
An error occurred at line: 10 in the jsp file: /example_2.jsp
Syntax error on token(s), misplaced construct(s)
7: <%
8: i++;
9: %>
10: <p>你是第<% =i %>
11: 个访问本站的客户。
12: </p>
13: </font>
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.10
不知是哪里错了 所以希望有谁能指点一下 不甚感激