日期:2014-05-18  浏览次数:20610 次

Tomcat中运行.JSP出现错误
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:   /first.jsp(1,1)   Page   directive   has   invalid   attribute:   contextType
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:200)
org.apache.jasper.compiler.JspUtil.checkAttributes(JspUtil.java:304)
org.apache.jasper.compiler.Validator$DirectiveVisitor.visit(Validator.java:100)
org.apache.jasper.compiler.Node$PageDirective.accept(Node.java:549)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Validator.validate(Validator.java:1438)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:214)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Apache   Tomcat/5.0.28   logs.

请问怎么解决?

.JSP文件中代码如下:
<%@page   language= "java "   contextType= "text/html;charset=gb2312 "%>
<%@page   info= "a   JSP   example "%>
<html>
<head> <title> 第一个JSP </title> </head>
        <body> <div   align= "center ">
                        <table>
          <tr> <td> 2005新生班级 </td> <td> 班号 </td> </tr>
    <%        
              int   i;
              String   color1= "99ccff ";
              String   color2= "88cc33 ";
              for(i=1;i <=10;i++)
              {
                    String   color= " ";
                    if(i%2==0)