日期:2014-05-17  浏览次数:20932 次

请教jsp文件page指令报错的问题
我写的一个jsp文件的前面的page指令是:
  
<% @ page language="java" errorPage="error.jsp" contentType="text/html ;charset=gbk"%>


但是浏览器针对这一行报了这么多错:

An error occurred at line: 1 in the jsp file: /Divide.jsp
Syntax error on token "language", VariableDeclaratorId expected after this token
1: <% @ page language="java" errorPage="error.jsp" contentType="text/html ;charset=gbk"%>
2: <html><title>Divide</title>
3: <body>
4: <%


An error occurred at line: 1 in the jsp file: /Divide.jsp
language cannot be resolved to a type
1: <% @ page language="java" errorPage="error.jsp" contentType="text/html ;charset=gbk"%>
2: <html><title>Divide</title>
3: <body>
4: <%


An error occurred at line: 1 in the jsp file: /Divide.jsp
Syntax error, insert ";" to complete LocalVariableDeclarationStatement
1: <% @ page language="java" errorPage="error.jsp" contentType="text/html ;charset=gbk"%>
2: <html><title>Divide</title>
3: <body>
4: <%


An error occurred at line: 1 in the jsp file: /Divide.jsp
errorPage cannot be resolved
1: <% @ page language="java" errorPage="error.jsp" contentType="text/html ;charset=gbk"%>
2: <html><title>Divide</title>
3: <body>
4: <%


An error occurred at line: 1 in the jsp file: /Divide.jsp
Syntax error, insert ";" to complete Statement
1: <% @ page language="java" errorPage="error.jsp" contentType="text/html ;charset=gbk"%>
2: <html><title>Divide</title>
3: <body>
4: <%


An error occurred at line: 1 in the jsp file: /Divide.jsp
contentType cannot be resolved
1: <% @ page language="java" errorPage="error.jsp" contentType="text/html ;charset=gbk"%>
2: <html><title>Divide</title>
3: <body>
4: <%


An error occurred at line: 1 in the jsp file: /Divide.jsp
Syntax error, insert ";" to complete Statement
1: <% @ page language="java" errorPage="error.jsp" contentType="text/html ;charset=gbk"%>
2: <html><title>Divide</title>
3: <body>
4: <%



我算是彻底崩溃了,似乎浏览器根本就不认识 @ page 标志,哪位大哥也遇到过此类情形,求指教。



------解决方案--------------------
%@ 之间空格去掉