| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1155 人关注过本帖
标题:新手刚上路 就碰问题 故来请教
取消只看楼主 加入收藏
rmfish
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2006-10-17
收藏
 问题点数:0 回复次数:2 
新手刚上路 就碰问题 故来请教

刚上手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


不知是哪里错了 所以希望有谁能指点一下 不甚感激

搜索更多相关主题的帖子: Jsp 网页 tomcat 
2007-08-05 09:15
rmfish
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2006-10-17
收藏
得分:0 
回复:(rmfish)新手刚上路 就碰问题 故来请教

谢谢了 我改了 但是问题是一样的
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=gb2312" %>
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=gb2312" %>
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=gb2312" %>
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

2007-08-05 09:30
rmfish
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2006-10-17
收藏
得分:0 
回复:(rmfish)回复:(rmfish)新手刚上路 就碰问...
谢谢楼上的 正解 感激不尽~~
2007-08-05 16:52
快速回复:新手刚上路 就碰问题 故来请教
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018559 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved