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

jsp泛型错误问题。。。求解啊!!!
jsp代码
Java code
<%@ page  contentType="image/jpeg; charset=GBK" import="serverDAO.*" %>

  <%

  response.setHeader("Pragma","No-cache");

  response.setHeader("Cache-Control","no-cache");

  response.setDateHeader("Expires", 0);

  RandImgCreater rc = new RandImgCreater(response);

  //RandImgCreater rc = new RandImgCreater(response,8,"abcdef");

  //rc.setBgColor(100,100,100);

  String rand = rc.createRandImage();

  session.setAttribute("rand",rand);

  %>


控制台错误显示:
严重: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 5 in the jsp file: /yzxml.jsp
Syntax error on tokens, delete these tokens
2: 
3:   <%
4: 
5:   response.setHeader("Pragma","No-cache");
6: 
7:   response.setHeader("Cache-Control","no-cache");
8: 


An error occurred at line: 7 in the jsp file: /yzxml.jsp
Syntax error on tokens, delete these tokens
4: 
5:   response.setHeader("Pragma","No-cache");
6: 
7:   response.setHeader("Cache-Control","no-cache");
8: 
9:   response.setDateHeader("Expires", 0);
10: 


An error occurred at line: 9 in the jsp file: /yzxml.jsp
Syntax error on tokens, delete these tokens
6: 
7:   response.setHeader("Cache-Control","no-cache");
8: 
9:   response.setDateHeader("Expires", 0);
10: 
11:   RandImgCreater rc = new RandImgCreater(response);
12: 


An error occurred at line: 11 in the jsp file: /yzxml.jsp
Syntax error on tokens, delete these tokens
8: 
9:   response.setDateHeader("Expires", 0);
10: 
11:   RandImgCreater rc = new RandImgCreater(response);
12: 
13:   //RandImgCreater rc = new RandImgCreater(response,8,"abcdef");
14: 


An error occurred at line: 13 in the jsp file: /yzxml.jsp
Syntax error on tokens, delete these tokens
10: 
11:   RandImgCreater rc = new RandImgCreater(response);
12: 
13:   //RandImgCreater rc = new RandImgCreater(response,8,"abcdef");
14: 
15:   //rc.setBgColor(100,100,100);
16: 


An error occurred at line: 19 in the jsp file: /yzxml.jsp
Syntax error on tokens, delete these tokens
16: 
17:   String rand = rc.createRandImage();
18: 
19:   session.setAttribute("rand",rand);
20: 
21:   %>
22: 


An error occurred at line: 21 in the jsp file: /yzxml.jsp
Syntax error on tokens, delete these tokens
18: 
19:   session.setAttribute("rand",rand);
20: 
21:   %>
22: 


Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
。。。。。。。。。。。。
网上找了好久答案,没有所获啊,几个jsp页面,就这个有问题,我jdk是1.7的,应该没问题。
求大神解释啊!!