- 主题:(求助)第一个jsp错误是怎么回事?
我按照书上所说,把HelloWorldDemo.jsp放在了Tomcat7\webapps\Root中。
运行时,以下是错误信息:
----------------
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: /HelloWorldDemo.jsp
Syntax error on token "language", VariableDeclaratorId expected after this token
1: <% @ page language="java" contentType="text/html; charset=gb2312" pageEncoding="gb2312" %>
2:
3: <html>
4: <head>
An error occurred at line: 1 in the jsp file: /HelloWorldDemo.jsp
language cannot be resolved to a type
1: <% @ page language="java" contentType="text/html; charset=gb2312" pageEncoding="gb2312" %>
2:
3: <html>
4: <head>
An error occurred at line: 1 in the jsp file: /HelloWorldDemo.jsp
Syntax error, insert ";" to complete LocalVariableDeclarationStatement
1: <% @ page language="java" contentType="text/html; charset=gb2312" pageEncoding="gb2312" %>
2:
3: <html>
4: <head>
----------------
以下是HelloWorldDemo.jsp内容:
<% @ page language="java" contentType="text/html; charset=gb2312" pageEncoding="gb2312" %>
<html>
<head>
<title>第一个JSP程序</title>
</head>
<body>
<% String greeting= "Hello, World!";
out.println(greeting);
%>
</body>
</html>
错在哪里?
--
FROM 221.217.99.*
than book should go to your trash can.
【 在 useCASE (usecase) 的大作中提到: 】
: 我按照书上所说,把HelloWorldDemo.jsp放在了Tomcat7\webapps\Root中。
: 运行时,以下是错误信息:
: ----------------
: ...................
--
FROM 180.173.173.*
你的词有错啊
不看那书怎么学?我觉得还是印在纸上的字看起来合适。
【 在 XeCycle 的大作中提到: 】
: than book should go to your trash can.
:
--
FROM 221.217.99.*
我找到问题的原因了
第一行的%与@之间不应有空格,否则就出错。
--
FROM 221.217.99.*