3 Replies Latest reply on Oct 31, 2003 3:07 AM by krypton

    the result----

    limy Newbie

      I created a file of .jsp which calls a servlet(listed). The result i got as follows when running .jsp. I don't know why. Who can pass me the key?


      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: null

      Generated servlet error:
      [javac] Compiling 1 source file

      E:\tomcat\work\Standalone\localhost\myapp\quiz_jsp.java:30: 'try' without 'catch' or 'finally'
      try {
      ^
      E:\tomcat\work\Standalone\localhost\myapp\quiz_jsp.java:186: illegal start of type
      } catch (Throwable t) {
      ^
      E:\tomcat\work\Standalone\localhost\myapp\quiz_jsp.java:193: expected
      }
      ^
      E:\tomcat\work\Standalone\localhost\myapp\quiz_jsp.java:195: 'class' or 'interface' expected
      }
      ^
      E:\tomcat\work\Standalone\localhost\myapp\quiz_jsp.java:196: 'class' or 'interface' expected

      ^
      5 errors


      at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
      at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
      at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
      at java.lang.Thread.run(Thread.java:479)


      --------------------------------------------------------------------------------

      Apache Tomcat/4.1.27




      The file i edited as follows:



      Testing via net
      <meta http-equiv="Content-Type" content="text/html; charset=gb2312">




      <%@page language="java" %>
      <jsp:useBean id="quiz" scope="session" class="quiz.quiz"/>


      <%=quiz.getQuizName() %>




      <%

      int current=quiz.getCurrent();

      String reset=null;
      reset=request.getParameter("Reset");
      if(reset==null) reset="";
      if(reset.equals("1")) quiz.reset();

      int iqn=0;

      String question=null;
      question=request.getParameter("QuestionNum");
      if(question==null){question="";iqn=0;}
      else { Integer tmp=new Integer(question); iqn=tmp.intValue();}

      if(iqn!=0){ current++; quiz.setCurrent(current);}

      String answer=null;
      answer=request.getParameter("Answer");
      if(answer==null) answer="";

      if(quiz.getCurrent()>quiz.getCount())
      {
      if(quiz.getCorrect()>6)
      {
      %>
      Congratulations! You achieve <%=quiz.getCorrect() * 10 %> and get thougth the test!
      <%
      }
      else
      {
      %>
      Sorry,you have to get 60 to break through.
      If you want to try once more please click
      HERE
      <%
      }
      }
      else
      {
      if(iqn==0)
      {
      if(answer.equals(quiz.getCorrectAnswer(quiz.getCurrent()-1)))
      {
      quiz.setCorrect(quiz.getCorrect()+1);
      }
      }
      else
      {
      if(answer.equals(quiz.getCorrectAnswer(quiz.getCurrent()-2)))
      {
      quiz.setCorrect(quiz.getCorrect()+1);
      }
      }
      %>



      Totle QNo:<%=quiz.getCount() %> You stay at <%=quiz.getCurrent() %>

      <%=current %>
      <%
      out.println(quiz.getQuizQuestion(current-1));
      %>



      <%
      out.println(quiz.getQuizAnswer(current-1,0));
      %>



      <%
      out.println(quiz.getQuizAnswer(current-1,1));
      %>


      <%
      out.println(quiz.getQuizAnswer(current-1,2));
      %>



      <%
      out.println(quiz.getQuizAnswer(current-1,3));
      %>





      <%
      }
      }
      %>